newLISP language support for Visual Studio Code

Notices and updates

newLISP language support for Visual Studio Code

Postby fdb » Sat Jun 01, 2019 8:53 pm

I've made a GitHub repository with language support for newLISP in Visual Studio code: https://github.com/luxint/vscode-newlisp.

If you don't now VS Code have a look at https://code.visualstudio.com, a very nice free editor, built on open source, from Microsoft, runs on Windows, Mac and Linux.

Current state of the extension is it does newLISP syntax highlighting, launching a newLISP REPL and evaluating the active file in the REPL. What I want to add is several color theme's and snippets (to show function syntax and explanations when 'hovering').

This is how it looks with theme Monokai: https://github.com/luxint/vscode-newlisp/blob/master/images/Screenshot%202019-06-01%20at%2022.18.57.png

Blue: the 'meta' functions (define, define-macro, macro, fn, lambda, lambda-macro)
Red: mutable primitive functions (set, push, ..)
Green: non-mutable primitive functions (list, array, append, ..)
Purple: numbers (integers, floats, bigints, ..)
Yellow: strings
Grey: quoted literals and comments
White: the rest

If you want to collaborate, need different colors or have ideas how to make this better, let me know!
fdb
 
Posts: 47
Joined: Sat Nov 09, 2013 8:49 pm

Re: newLISP language support for Visual Studio Code

Postby rickyboy » Sat Jun 01, 2019 11:37 pm

Nice!

I would collab but I don't use VS Code (nor linux, nor windows, nor mac). :)

(However, I just sent a PR on your other gh project.) Best, --Rick
(λx. x x) (λx. x x)
rickyboy
 
Posts: 595
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Re: newLISP language support for Visual Studio Code

Postby cameyo » Sun Jun 02, 2019 11:12 am

Thanks fdb!!!
I use notepad++, but i'd like to use VSCode on mac :-)
I'll try it as soon as possible.
It's possible to execute the current line on newLISP REPL?
It's possible to execute the active selection on newLISP REPL?
Thanks again.
cameyo
cameyo
 
Posts: 89
Joined: Sun Mar 27, 2011 3:07 pm

Re: newLISP language support for Visual Studio Code

Postby fdb » Sun Jun 02, 2019 12:12 pm

Hi cameyo,

I had added the possibility to execute the active selection in the REPL but had problems getting it to work reliable so I chose to first release without it. My way of working is that I usually test my one liners in the repl first, for multi line functions I enter them in the editor, save them with cmd-S and then load them in the repl with alt-L.

Let me know if everything works ok for you.

Ferry
fdb
 
Posts: 47
Joined: Sat Nov 09, 2013 8:49 pm

Re: newLISP language support for Visual Studio Code

Postby cameyo » Sun Jun 02, 2019 2:02 pm

Hi fdb,
with notepad++ i never write text on REPL.
Left Shift + Enter -> Evaluate current line
Rigth Shift + Enter -> Evaluate current selection
Alt + F1 Open local newlisp help for selected keyword.
cameyo
cameyo
 
Posts: 89
Joined: Sun Mar 27, 2011 3:07 pm

Re: newLISP language support for Visual Studio Code

Postby fdb » Mon Jun 03, 2019 10:46 pm

Hi,

I've added the ability to evaluate selected expression(s), it will either send the current selection to the REPL or, if nothing is selected, it will select the 'first' expression within the cursor position to the REPL. This 'first expression' starts 1 position left to cursor if this is a opening bracket, otherwise the next opening bracket to the right and then finds the matching closing bracket. (This seems to be the behaviour of the editor.action.selectToBracket command of the VS Code editor and the easiest way to implement selections).

Only single new lines within the expression are supported, let me know if it works, only tried this at my MacBook
fdb
 
Posts: 47
Joined: Sat Nov 09, 2013 8:49 pm

Re: newLISP language support for Visual Studio Code

Postby cameyo » Thu Jun 06, 2019 7:04 pm

I have tried the extension on windows.
The syntax highlighting is nice.
The command 'alt+z' and 'alt+l' don't work on my system.
The errors are: "Command 'newlisp.eval' not found" and "Command 'newlisp.evalFile' not found"
(see image: https://imgur.com/a/w3QBMws)
To eval newlisp statements i do the following:
Add these lines to the file "keybindings.json":
(Shift+Enter to run selected text or current line)
(switch editor <--> terminal)
Code: Select all
{ "key": "shift+enter",
  "command": "workbench.action.terminal.runSelectedText"}
{ "key": "ctrl+`",
"command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus" },
{ "key": "ctrl+`", "command": "workbench.action.terminal.focus", "when": "!terminalFocus" },

Now, open Terminal and run newlisp.exe:
Code: Select all
(+ 1 2 3)
(define (sum a b)
    (add a b))
(sum 2 3)

cameyo
cameyo
 
Posts: 89
Joined: Sun Mar 27, 2011 3:07 pm

Re: newLISP language support for Visual Studio Code

Postby fdb » Thu Jun 06, 2019 7:51 pm

Hi cameyo,

The keybindings are in the package.json file, have you tried reloading: view/command palette/developer:reload window? If you have customised keybindings (with keybindings.json) you may have keybinding conflicts.
fdb
 
Posts: 47
Joined: Sat Nov 09, 2013 8:49 pm

Re: newLISP language support for Visual Studio Code

Postby cameyo » Fri Jun 07, 2019 9:05 am

Hi fdb,
I have installed VS Code and your extension in a new PC.
'Alt+L' and 'Alt+Z' don't work in my system.
I'll try it on Mac this weekend.
Thanks for your work
cameyo
cameyo
 
Posts: 89
Joined: Sun Mar 27, 2011 3:07 pm

Re: newLISP language support for Visual Studio Code

Postby protozen » Tue Jul 02, 2019 10:25 pm

This is great to see, I'll check it out, thank you.
protozen
 
Posts: 36
Joined: Thu Aug 22, 2013 4:02 am


Return to newLISP newS

Who is online

Users browsing this forum: No registered users and 1 guest

cron