GithubHelp home page GithubHelp logo

pkulchenko / zerobranestudio Goto Github PK

View Code? Open in Web Editor NEW
2.6K 147.0 516.0 142.9 MB

Lightweight Lua-based IDE for Lua with code completion, syntax highlighting, live coding, remote debugger, and code analyzer; supports Lua 5.1, 5.2, 5.3, 5.4, LuaJIT and other Lua interpreters on Windows, macOS, and Linux

Home Page: http://studio.zerobrane.com/

License: Other

Lua 98.49% CMake 0.14% Shell 1.20% C 0.16% Batchfile 0.01%
lua ide syntax-highlighting zerobrane-studio debugger editor lua-engines zerobrane wxwidgets-applications

zerobranestudio's Introduction

Project Description

ZeroBrane Studio is a lightweight cross-platform Lua IDE with code completion, syntax highlighting, remote debugger, code analyzer, live coding, and debugging support for various Lua engines (Lua 5.1, Lua 5.2, Lua 5.3, Lua 5.4, LuaJIT, LÖVE, Moai, Gideros, Corona, Marmalade Quick, Cocos2d-x, OpenResty/Nginx, Torch7, Redis, GSL-shell, Adobe Lightroom, Lapis, Moonscript, and others).

ZeroBrane Studio debugger screenshot

Features

  • Small, portable, and cross-platform (Windows, macOS, and Linux).
  • Written in Lua and is extensible with Lua packages.
  • Syntax highlighting and folding for 125+ languages and file formats.
  • Project view with auto-refresh and ability to hide files and directories from the list.
  • Bundled with several of the most popular Lua modules (luasocket, luafilesystem, lpeg, and luasec) compiled for all supported Lua versions.
  • Auto-complete for functions, keywords, and custom APIs with scope-aware completion for variables.
  • Scope-aware variable indicators for Lua code.
  • Integrated debugger with local and remote debugging for Lua 5.1, Lua 5.2, Lua 5.3, Lua 5.4, LuaJIT, and other Lua engines.
  • Interactive console to directly test code snippets with local and remote execution.
  • Live coding with Lua, LÖVE, Gideros, Moai, Corona SDK, GSL-shell, and other engines.
  • Static analysis to catch errors and typos during development.
  • Function outline.
  • Go to definition navigation.
  • Multi-cursor editing with scope-aware variable selection and renaming.
  • Fuzzy search with Go To File, project-wide Go To Symbol navigation, and Insert Library Function.
  • Find and replace in multiple files with preview and undo.
  • Several ways to extend the current functionality:
    • packages (packages/): plugins that provide additional functionality;
    • translations (cfg/i18n/): translations of the menus and messages to other languages;
    • user configuration (cfg/): settings for various components, styles, color themes, and other preferences.

Documentation

Installation

The IDE can be installed into and run from any directory. There are three options to install it:

No compilation is needed for any of the installation options, although the scripts to compile required libraries for all supported platforms are available in the build/ directory.

See the installation section in the documentation for further details and uninstallation instructions.

Usage

The IDE can be launched by using the zbstudio command with slight variations depending on whether a packaged installation or a repository copy is used:

  • Windows: Run zbstudio from the directory that the IDE is installed to or create a shortcut pointing to zbstudio.exe.
  • Linux: Run zbstudio when installed from the package installation or run ./zbstudio.sh when using a snapshot/clone of the repository.
  • macOS: Launch the ZeroBrane Studio application if installed or run ./zbstudio.sh when using a snapshot/clone of the repository.

The general command for launching is the following: zbstudio [option] [<project directory>] [<filename>...].

  • Open files: zbstudio <filename> [<filename>...].
  • Set project directory (and optionally open files): zbstudio <project directory> [<filename>...].
  • Overwrite default configuration: zbstudio -cfg "string with configuration settings", for example: zbstudio -cfg "editor.fontsize=12; editor.usetabs=true".
  • Load custom configuration file: zbstudio -cfg <filename>, for example: zbstudio -cfg cfg/xcode-keys.lua.

All configuration changes applied from the command line are only effective for the current session.

If you are loading a file, you can also set the cursor on a specific line or at a specific position by using filename:<line> and filename:p<pos> syntax (0.71+).

In all cases only one instance of the IDE will be allowed to launch by default: if one instance is already running, the other one won't launch, but the directory and file parameters passed to the second instance will trigger opening of that directory and file(s) in the already started instance.

Contributing

See CONTRIBUTING.

Author

ZeroBrane Studio and MobDebug

ZeroBrane LLC: Paul Kulchenko ([email protected])

Estrela Editor

Luxinia Dev: Christoph Kubisch ([email protected])

Where is Estrela?

The Estrela project that this IDE is based on has been merged into ZeroBrane Studio. If you have used Estrela for graphics shader authoring, you can use this GraphicsCodePack to get access to all API files, specifications and tools.

License

See LICENSE.

zerobranestudio's People

Contributors

b-and-p avatar bartoleo avatar brynne8 avatar crumblingstatue avatar deining avatar dkulchenko avatar dvdvideo1234 avatar fbosio avatar feserr avatar fnaith avatar halfnelson avatar inigosola avatar kikito avatar kodemeister avatar madmaxoft avatar moteus avatar mrichards42 avatar nickchops avatar numberzero avatar olueiro avatar pi avatar pixeljetstream avatar pkulchenko avatar rm-code avatar sclark39 avatar sience avatar tieske avatar tiwb avatar tmiv avatar yonaba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zerobranestudio's Issues

scratchpad issue

An issue with the scratchpad, resulting in errors, Win7/32bit.

Reproduce:

  • Paste this code in a file
    local _tostring = tostring
    function tostring(value)
      local str = ''
      if (type(value) ~= 'table') then
        if (type(value) == 'string') then
          str = string.format("%q", value)
        else
          str = _tostring(value)
        end
      else
        local auxTable = {}
        table.foreach(value, function(i, v)
          if (tonumber(i) ~= i) then
            table.insert(auxTable, i)
          else
            table.insert(auxTable, tostring(i))
          end
        end)
        table.sort(auxTable)
        str = str..'{'
        local separator = ""
        local entry = ""
        table.foreachi (auxTable, function (i, fieldName)
          if ((tonumber(fieldName)) and (tonumber(fieldName) > 0)) then
            entry = tostring(value[tonumber(fieldName)])
          else
            entry = fieldName.." = "..tostring(value[fieldName])
          end
          str = str..separator..entry
          separator = ", "
        end)
        str = str..'}'
      end
      return str
    end
    print (tostring( {"hello", "world", ["subA"] = {"table", "within", ["one"] = {"level", 3}}}))
    
    
- press ctrl+F6 - output is properly displayed - now move mouse cursor over any "tostring" function call in the editor and wait for tooltip.

Output goes berserk, while tooltip shows an error

add os x support

I'm sure it's rather identical to linux support and as far as it doesn't involve c/c++ programming I can participate.

P.S.
отличный проект!

add compilation time

silly annoyance;
when coding, press F7 regularly to compile, the output says "Compilation successful.", now sometime later press F7 again.... nothing changes, feels like it didn't compile.

So, can you add a compile date/time to the message? so you'll see an update in the output window?

really silly, but probably also easy to fix.

Configure analyzer to ignore specific variables and errors

Need to be able to recognize specific global variables and not report them. This can be done by either marking specific variables or specific error types. For example,

--! skip(id = {'globa'}, err = {'first-use-glob-var', 'first-use-glob-func', 'first-assign-glob-var'})
globa = 123 -- assignment to global var
foo() -- using global function

skip(id = {'foo'}) skips reporting of any errors for variable/function foo and skip(err={'first-use-glob-var'}) or skip(err = {err.firstuseglobvar}) skips reporting of that particular error for any variable.

Editing lua-file in utf-8 without BOM

I'm using utf-8 without BOM in lua scripts to write utf-8 characters (russian text to output). When I'm opening some of these the editor don't recognized properly the codepage of file.
How can I specify right code page for file ?

Breakpoints not working with debugger and Love2d

Breakpoints are not working for me, though I can force a break via shift-F9, and close the app via Stop Debugging. The debugger simply flies past my breakpoints.

Tried:
Moving interpreter into games project parent folder
Using current code from github
Checked all firewall settings

Windows 7 x64, ZeroBrainStudio 0.31, Love2d 0.8.0-win-x86.

Functions with multiple dots/colons are not recognized (two spec\lua.lua problems)

In the moment I have three problems with the isfncall and isfndef functions.
isfndef doesn't find functions like "function dut.power.on( ... )"

(addressed in issue #18) But isfncall and isfndef find function calls and function definitions in strings and comments samples:

-- function incomment(b) return b end
local str1 = " ab = function  (df, f) -- test()"

In the moment I replace the functions isfncall and isfndef
during the app.lua preinit function call with my own functions to fix the problems.
(For block comments and strings I have no fix.)

Perhaps you can update the spec\lua.lua file.

-- my preinit code --
--update spec/lua.lua
local function isfncall(str)
    str = string.gsub(str,"\"(.-)\"","\"\"")      -- do not search in strings....
    local _,_, cmd = string.find(str,"(.-)%-%-")  -- do not search in comments
    if cmd then str = cmd end
    return string.find(str,"([%w_]+)%s*%(")
end

local function isfndef(str)
    str = string.gsub(str,"\"(.-)\"","\"\"")      -- do not search in strings....
    local _,_, cmd = string.find(str,"(.-)%-%-")  -- do not search in comments
    if cmd then str = cmd end
    local l
    local pcap = "function%s+([%w_]+%s*[%.%:]?%s*[%w_]*%s*[%.%:]?%s*[%w_]*)%s*"
    local ppar = "(%(.-%))"
    local s,e,cap,par = string.find(str,pcap..ppar)
    if (not s) then
      -- try to match without brackets now, but only at the beginning of the line
      s,e,cap = string.find(str,"^%s*"..pcap)
    end
    if (not s) then
      -- try to match "foo = function()"
      s,e,cap,cap1,cap2,par = string.find(str,"(([%w_]+%s*[%.%:]?%s*)([%w_]*%s*[%.%:]?%s*[%w_]*))%s*=%s*function%s*(%(.-%))")
      -- check if we captured 'local foo =' instead of 'foo.bar ='
      if cap1 and cap2 and string.len(cap2) > 0 and not string.find(cap1,'[%.%:]') then
        cap = cap2
        s = s + string.len(cap1)
      end
    end
    if (s) then
      l = string.find(string.sub(str,1,s-1),"local%s+$")
      cap = cap .. " " .. (par or "(?)")
    end
    return s,e,cap,l
end

-- replace the spec\lua.lua functions 
if  ide.specs["lua"] then
    ide.specs["lua"].isfncall = isfncall
    ide.specs["lua"].isfndef = isfndef
end

Missing dll dependency (libstdc++-6.dll not found)

Hallo,

I have a simple problem on one of my Windows 7 PCs.
zbstudio (master branch) can not start, because the wx.dll depends on the missing libstdc++-6.dll.

If I replace the wx.dll with the dll from wxLua-2.8.12.2-MSW-Unicode.zip download
zbstudio work without any problems.

Reports a missing dependency on OSX 10.6.8

Under OSX 10.6.8, the application fails with the following error:

error loading module 'wx' from file 'bin/libwx.dylib':
        dlopen(bin/libwx.dylib, 2): Library not loaded: /usr/lib/libedit.3.dylib

Also reported on the maillist.

The solution seems to be to add a symlink to libedit.2.dylib: sudo ln -s /usr/lib/libedit.2.dylib $DYLD_LIBRARY_PATH/libedit.3.dylib.

Extra character appears in editor when pressing cmd-s on the Mac

Hi there,

The Symtom

There is an issue at the moment for the mac build of zbstudio. When in the editor and if the user presses the "save" keyboard shortcut (cmd-s), the editor sometimes actually saves the currently active file, but sometimes inserts an "s" into the current cursor position.

The Problem

Standard wxWidget behavior

After spending the past few hours trying out wxWidget keyboard handling samples on both the mac and the PC. I verified that wxWidget itself, as the documentation indicates, do not treat keystrokes with modifier keys any differently than normal keystrokes. That means a keystroke combo like ctrl-a or ctrl-s will generate their corresponding KEY_DOWN, CHAR, and KEY_UP events.

The only reason why a ctrl key combo might omit these events is when an accelerator catches it. Obviously, any component along the event chain can also catch these events, handle them, and withhold the events from handlers further down the chain.

On the mac, wxWidget tries to do alter configured accelerators by mapping ctrl key combos to command key combos.

zbstudio behavior

In zbstudio on Windows systems, we observe that pressing any ctrl key combo either results in an an accelerator being invoked, or a "bell" noise.

On the mac, the behavior is very much the same. You can try all manners of ctrl key combos and the editor mostly seems to ignore them. But if you tried the same thing with the command key, the editor would respond by adding a single character to where your cursor is. Just try ctrl-b and then cmd-b in the editor.

And finally, we get down to the difference between why some modifier key combos are ignored and some are not...

The Diagnosis

zbstudio's editor is actually an instance of wxStyledTextCtrl, which is actually a wrapper around scintilla. wxStyledTextCtrl handles and transforms wxWidget events to something that would make sense for scintilla. That's where our bug is. The wrapper actually skips over all keystrokes if the keystroke has either ctrl or alt modifier. It does not account for when the cmd key is pressed.

The function is pretty straight forward and can be found here:
https://github.com/wxWidgets/wxWidgets/blob/WX_2_8_BRANCH/contrib/src/stc/stc.cpp#L3105

So that's it. wxStyledTextCtrl isn't correctly catching and discarding cmd key combos.

The Fix

I suppose the best fix is to fix wxStyledTextCtrl. It's two lines to make the change. But from what I'm seeing on the wxWidget bugtracking system, it can take a looooong time for bugfixes to be folded into the official release. So we can either:

  1. Create our own version of wxStyledTextCtrl and use it in zbstudio
    This seems feasible and makes things relatively clean. It might also be useful to have full control over the wrapper around scintilla.
  2. Patch in a fix at the editor
    Obviously the fastest way to fix this is to just ignore all keystrokes where the CmdDown is true.

(Linux) Context menu in the editor window doesn't work

Now selecting any item in the context menu causes the following Lua exception:

Lua: Error while running chunk
src/editor/menu_edit.lua:71: attempt to index a nil value
stack traceback:
    src/editor/menu_edit.lua:71: in function <src/editor/menu_edit.lua:65>
    [C]: in function 'PopupMenu'
    src/editor/editor.lua:561: in function <src/editor/editor.lua:540>
    [C]: in function 'MainLoop'
    src/main.lua:400: in main chunk
    [C]: ?

Code analysis reports a.b and a:b as anonymous function

Create a new file with the following code;

statevariable = {}
function statevariable:afterset(oldval)
end

Now do code analysis (shift-F7 on Win7)

the results will be;
C:\Users\Thijs\Desktop\untitled.lua(2): unused parameter 'oldval' in anonymous function
while it is not an anonymous function

editor bug; deleting comment block

Win7-32

create a file (see below), select the full comment block (just the comment lines) and press <Del>, the text remains, only no longer selected. Even individual lines cannot be deleted, just character by character.

testfile contents to reproduce:

--- *Aliases: `add_option`*

---
--- ### Parameters
--- 1. **key**: the argument identifier, can be either `-key`, or `-key, --expanded-key`:
--- if the first notation is used then a value can be defined after a space (`'-key VALUE'`),
--- if the 2nd notation is used then a value can be defined after an `=` (`'key, --expanded-key=VALUE'`).
--- 1. **desc**: a description for the argument to be shown in --help
--- 1. **ref**: *optional*; override where the value will be stored, @see cli:add_arg
--- 1. **default**: *optional*; specify a default value (the default is "")

---
--- ### Usage example
--- The following option will be stored in `args["i"]` with a default value of `my_file.txt`:
--- `cli:add_option("-i, --input=FILE", "path to the input file", nil, "my_file.txt")`
function cli:add_opt(key, desc, ref, default)

end

Some menu items aren't disabled when all tabs are closed

The following main menu items should be disabled after closing the last editor tab:

  • File - Save (causes exception)
  • Edit - Show Tooltip (causes exception)
  • Search - Find Next
  • Search - Find Previous
  • View - Full Screen (the entire screen becomes gray and Esc doesn't work anymore)

Also I think it would be nice to have Search - Find In Files and Search - Replace In Files always enabled. We can still search in project files even if there are no opened documents.

Unsaved file shows source code in the analysis report

Create a new file (don't save it) and add the following code;

statevariable = {}
function statevariable:afterset(oldval)
end

Now do code analysis (shift-F7 on Win7), output contains the source code, not only the analysis results.

Additional configuring features

Can you add some additional features configured by user ?

  1. globals
  2. file extensions
  3. keywords

Now I'm configuring file extensions and keywords by changing spec\lua.lua . But I don't find where I add own global variables to exclude warning about them from analyzer.
I write scripts for FAR Manager using LuaFAR & LuaFAR for Editor that has own globals. And I want to add some identifiers as keywords (global vars, frequently used vars etc) and to colorize some keywords with special colors (for example, true & false).

IDE settings file is saved to non-standard locations

Currently the application settings file (ZeroBraneStudio.ini/EstrelaEditor.ini) is saved directly to $HOME directory which is not conventional on both Windows and Linux. Application configuration files are usually stored under the following locations:

  • On Windows: %APPDATA%\company, e.g. C:\Users\username\AppData\Roaming\ZeroBraneLLC\ZeroBraneStudio.ini
  • On Linux: ~/.config/company, e.g. /home/username/.config/ZeroBraneLLC/ZeroBraneStudio.ini
  • On Mac OS X: ~/Library/Preferences (seems to be already there)

Per-user configuration files (user.lua) should be also taken from the same directory, not from ~/.zbs/user.lua.

can't save files, without starting as admin (Win7-32)

I have to run the app with admin priviledges to be able to save anything.
Goes for edited files, but also when shutting down the preferences. In the latter case it shows a window;
caption: Error
message: can't open user configuration file.
details:
Failed to create temporary file name (error 5: access is denied.)
can't open user configuration file.

I disabled UAC, but that didn't change anything.
initially installed by unzipping the zip file, later using the installer. Both same results.

"module 'metalua.runtime' not found"

I've downloaded the *-0.28.zip pack, extracted, double-clicked "zbstudio.exe" and got a window with an error, starting as in title above. Screenshot embedded below.

auto-save functionality

Especially with the current (in)stability, auto save is a must have. I've only used it for a short while and already lost work twice.

Could be that the feature is in the editor, but I can't find any preferences, though the code in the lua files indicate that there should be some preferences somewhere.

As a side question; where to find any logs on the errors, or how else to help find the bugs?

(Linux) Multiple GTK assertion failures while running turtle samples

Almost all turtle samples run with massive slowdowns and print tons of error messages to the output window like this:

(lua:3856): Gdk-CRITICAL **: IA__gdk_gc_set_foreground: assertion `color != NULL' failed

Unfortunately I have no spare time for a further investigation but I've noticed that wxgtk doesn't like null pens at all. At least all error messages completely disappear when I comment out the following lines in turtle.lua:

mdc:SetPen(wx.wxNullPen)

Bug in function CommandLineRun

With the new Version I get an error if I try to run a script in a console window:
Sample code (modified luadeb):
return CommandLineRun(cmd,self:fworkdir(wfilename),false,true,nil,nil,
function() ide.debugger.pid = nil end)

Workaround in output.lua function CommandLineRun :

--local pid = wx.wxExecute(cmd, params, proc)
local pid = nil
if proc then
pid = wx.wxExecute(cmd, params, proc)
else -- proc is nil
pid = wx.wxExecute(cmd, params)
end

Cannot paste text into the Find Dialog

(Found on the mac) Hitting the paste keyboard shortcut when the Find Dialog is active does not paste into the "find" text field, but into the editor instead.

Make View menu items toggleable

A small enhancement. Usually View menu items are used to toggle windows visibility, not only to show them. In our case they are: Project/FileTree Window, Output/Console Window, Watch Window and Stack Window.

scroll wheel behavior

small annoyance (using Win7); scroll wheel scrolls the active window/pane instead of the window/pane the mouse is over.

Bug when using external editor

  1. Load lua-script.
  2. Press Shift-F7 to analyze.
  3. Click to output area.
  4. Edit script with external editor and save script in this editor.
  5. Click to ZBS editor area.
  6. Warning message about changes is showed:
    script.lua has been modified on disk.
    Do you want to reload it?
  7. Click OK.
    Now ZBS editor is in selecting mode (using mouse).
    And pressing Shift-F7 is not working.

Issue with input (ability to provide program input from IDE)

I downloaded the 0.29x version. I tried using the io.write and io.read, but the output screen doesn't let me enter in any values, so practically io.read() isn't working. Is there any way around this or is this something that's going to fixed in the upcoming versions?

I downloaded the Lua for windows, which gave me an metalua.runtime error. But your updated /src/main.lua fixed it. I assume this fix will be implemented in v0.30?

zbstudio can not start on win 7

Problem: os.getenv( "HOME" ) returns nil on my system.
main.lua line 271: addConfig(os.getenv( "HOME" ) .. "/.zbs/user.lua",false)

The Problem is that i haven't a HOME variable on my Windows 7 system.

if i change the code to
addConfig((os.getenv( "HOME" ) or "") .. "/.zbs/user.lua",false)
all works fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.