-
Notifications
You must be signed in to change notification settings - Fork 142
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
Tact highlight and grammar support for the VIM editor #320
Comments
Can it be extended it to Vim/Neovim? ... Although Neovim support requires a tree-sitter implementation from #302 |
@liketurbo Both Vim/Neovim can use regular expression-based grammars, but only Neovim has a valid option to use tree-sitter. So, it's probably better to just implement the latter, as it would also enable: GitHub-wise highlighting, other editors (I often use helix, for example). But if needed, I can do one specifically for Vim. |
@liketurbo I'm not sure, I'll try to figure out what is required in the community. In general, I prefer to do this in separate ton-bonties. |
It seems that we can add support to Neovim too(with a separate ton bounty). |
@reveloper Great. The Vim-specific implementation was in the private works of mine for a long time and it's near completed. Probably would take me a day or two to polish & publish it. Brb :) |
Still modifying... |
@novusnota Woah! What about grammar support, could you also implement this for Tact in VIM? |
@reveloper Do you mean autocomplete support? If so, then yes. And I'm aiming for full-coverage of grammar.ohm of Tact (essentially, it's actual formal specification), just like I did with the Prism.js grammars before. Needs about a day of work, the incomplete (and a bit broken at times) example of @zenixls2 really motivates to make mine even better :) |
Actually i made some references to both rust.vim and vim-solidity. |
@reveloper, I like your idea on add grammar support in addition to highlighting. After having a private conversation with you, $1500 seems totally acceptable, considering the complexity and the amount of work involved. You can be present during the execution. Please leave your repository where the progress will be tracked. |
If there's anything i could alsp help please let me know. I really need a strong plugin for tact. |
I've been extensively working on grammar support and plenty of other helpful features to present my plugin for Tact challengers. As tasks were planned to be revealed today, I'm planning to deliver final results today too. Stay tuned :) UPD: It had its own challenges, but I'm working to deliver it very soon! |
The biggest file in the whole plugin is tightly packed with grammar & context recognition for intelligent completion and even basic linting. I did a lot of rather convoluted RegExp work to make this happen, and it's at times smarter than the Language Server built in the official Tact plugin for VSCode :) I really want Tact users to be productive when using my plugin, hence I'm testing all the corner-cases (and, sometimes, adding small quality of life features). UPD: Sorry for the big delay in my work, trying to finish this soon 🙏 |
@novusnota This sounds awesome! We are looking forward to the release! |
@reveloper @delovoyhomie 🚀 Done! Whew, that took some time, apologies for the delays! Here's a screencast of creating a simple counter contract from the ground-up using my plugin: Note, that this shows only a fraction of possible configuration, completion and other options. Moreover, if I were to type this example with incorrect syntax that would've been detected by the basic linting capabilities, which are built in the completion as well 🔥 Link to the well-documented plugin repository: tact.vim P.S.: @zenixls2 here you go, a very strong plugin 👍 |
@novusnota, This looks fantastic, thank you for this great job! I have a few questions as an afterword:
|
The code throughout all the pars of the plugin is (IMHO):
Let's take a look at the That said, I think that I'll simply continue maintaining this plugin for new Tact updates as I know the codebase of my plugin already :) About moving it to |
@novusnota Awesome work! Could you please provide a minimal |
@anton-trunov Sure! Assuming you don't have any configuration in the Let's go:
unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim
let g:tact_style_guide = 1 " Enabling default indentation style
" the following is optional and added purely for your convenience:
inoremap <silent> <c-space> <c-x><c-o> " Open completion menu on ctrl-space
On Windows, do this in PowerShell:
git clone 'https://github.com/tpope/vim-sensible.git' $HOME\vimfiles\pack\tpope\start\sensible On Linux, macOS or *BSD: git clone 'https://github.com/tpope/vim-sensible.git' '~/.vim/pack/tpope/start/sensible'
On Windows, do this in PowerShell:
git clone 'https://github.com/novusnota/tact.vim.git' $HOME\vimfiles\pack\novusnota\start\tact On Linux, macOS or *BSD: git clone 'https://github.com/novusnota/tact.vim.git' '~/.vim/pack/novusnota/start/tact'
|
P.S.: @reveloper @delovoyhomie Sent a PR to Hall of Fame as well :) |
@novusnota Thank you so much for such a detailed explanation (I think that deserves to be put into a wiki, or as a separate page into that repo, targeting beginners). I could immediately see syntax highlighting, indentation works just fine for me. But auto-completion on When I type in
I would expect to see a drop-down menu with all the unsigned integer types listed. Any suggestions on how to fix it? |
But |
@anton-trunov Awesome, thanks 🤍 So, probably the only non-cross-platform thing about the plugin is the end-user keybindings. Therefore I only suggest, but not demand It turns out that on macOS CtrlSpace ( The simplest solution then is to disable or re-map it in the system settings to, say, CmdSpace. But I came up with two alternatives as well, pick the one you prefer: Using a different shortcut in VimFor example, `` in place of `` may work just fine as CmdSpace, but Vim is unpredictable when it comes to binding Cmd/Win keys, so that's kind of unreliable.Alternatively, you may try one of the following instead of
Making iTerm2 pass the shortcutIn similar fashion to how other GUI editors (like VSCode) deal with using CtrlSpace, you can try to intercept and override system keybindings in the current GUI app, and iTerm2 counts here too!To make an iTerm2 "keyboard shortcut" specifically for CtrlSpace do:
Here's how the UI of that process may look like: P.S.: Sure, I'll consider adding those two guides somewhere — either in the README, Wiki or tact-docs even, if it's appropriate :) |
Everything looks ready from my side, the bounty can be fully paid. @novusnota could you please transfer the repo under the |
@anton-trunov Yes, but first I need a permission to create new repositories there :) |
I just sent an invitation |
The transfer has been completed. Thanks a bunch! |
@novusnota Btw, is this plugin compatible with NeoVim? |
@anton-trunov Yes it is! While main focus was on Vim, Neovim out-of-the box is compatible with the plugin 🎉 Oh, and Neovim enables sane defaults automatically, so there's no need in sourcing the default file or adding a |
Thank you. I added |
@delovoyhomie @reveloper According to the updated guidelines, submitted:
P.S.: Forgot about the Questbook, now recovering. Only one proposal at a time is allowed to be made, so I'll submit a proposal for #302 right after this one gets resolved :) |
Rewards sent!Thank you for the contribution. |
Summary
Adding support for Tact programming language syntax highlighting in the VIM editor.
ton-bounty created with @footsteps_helper_bot
Context
The Tact programming language is widely used for high-level smart contract development in TON.
However, currently, there is no built-in syntax highlighting support for Tact in the VIM code editor. This project aims to address this issue by creating a plugin or extension that enables Tact syntax highlighting with grammar support in VIM.
VIM highlight and grammar extension for the Tact should be implemented with support in the vim-plug.
References
Alternative highlights for Tact:
Native grammar:
Estimate suggested reward
1500$ in TON
The text was updated successfully, but these errors were encountered: