-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate operators for all editors #1950
Conversation
editors/emacs/swarm-mode.el
Outdated
"-" | ||
"==" | ||
"!=" | ||
"<" | ||
">" | ||
"<=" | ||
">=" | ||
"||" | ||
"&&" | ||
"+" | ||
"-" | ||
"*" | ||
"/" | ||
"\\" | ||
":" | ||
"^" | ||
"++" | ||
"$" | ||
"->" | ||
"<-" | ||
"=") | ||
t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the list of operators are not in sync across editors. I'd like a second pair of eyes to check if this covers all or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- What is
\\
? Is that lambda? - There is duplicate
-
because one is unary, but that is OK. ++
will not matter I think, because+
will be parsed twice instead. Should not be noticeable though.
It's probably best idea to test in emacs, but it looks good to me. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. +
gets parsed twice and covers for ++
as well! Thanks for catching that 😄
What is \ ? Is that lambda?
Yes. Should this not be there? It's quite possible I might've added something extra.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why add it manually when you can copy the output of cabal run swarm:swarm-docs -- editors --emacs
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I needed to get some input on what the operators are for now.
The list generated by operatorNames
in it's current implementation does not cater to emacs (and possibly vim). Emacs fails to parse the generated list because of escaping where it does not need it.
But ultimately I'll be using that command once I figure out the requirements by emacs and vim.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xsebek My recent commit ensures that there's no manual labour involved. All the operators can now simply be copied to respective config files by running the cabal run
command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for bringing even Vim up-to-date. 🙂
Currently, operator names are generated only for vscode only using the command
cabal run swarm:swarm-docs -- editors --code
.With this PR, I intend to bring that behaviour to all the editors.
Changes include:
cabal run swarm:swarm-docs -- editors
command now supportsvim
as well.operatorNames
can generate operator list catering to all the editors supporting Swarm.swarm-mode.el
,swarm.vim
andswarm.tmLanguage.yaml
.How to test emacs syntax:
editors/emacs/swarm-mode.el
in emacs.M-x eval-buffer
.sw
file underexamples
.M-x swarm-mode
How to test vim syntax:
cp editors/vim/swarm.vim ~/.vim/syntax/sw.vim
echo 'autocmd BufRead,BufNewFile *.sw set filetype=sw' > ~/.vim/ftdetect/sw.vim
.sw
files underexamples
. (Also ensure that you have syntax on in vim.ESC :syntax on
)