GithubHelp home page GithubHelp logo

tact-lang / tact.vim Goto Github PK

View Code? Open in Web Editor NEW
14.0 14.0 2.0 161 KB

⚡ All-in-one Vim 8+ plugin for Tact programming language

Home Page: https://tact-lang.org

Vim Script 100.00%
neovim tact tact-lang ton vim

tact.vim's People

Contributors

novusnota avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

tact.vim's Issues

Enhance build system and integration with Tact compiler

  1. Set makeprg to match builds with and without Blueprint
  2. Set errormsg to match error messages coming from those builds.
  3. Fill quickfix list with messages from the compiler (and provide better tools/mappings for using this list), see: https://github.com/vim/vim/blob/v8.2.5172/runtime/doc/quickfix.txt

Additionally, consider using @tact-lang/compiler or its CLI for:

  1. Inference and suggestions
  2. Error handling
  3. Builds

Moreover, try introducing an auto-generation or basic help with tact.config.json. Suggest using JSON Schema.

Replace the current RegExp-based brittle parser with a new prototype

Problems with current RegExp-based parsing

  • it's too brittle
  • it's incomplete and won't be able to compete with proper parsing algorithms (although it manages to provide better completions than current VSCode plugin somehow :)
  • it's rather slow, with delays for completion starting somewhere at 1,000 LoC of Tact or even earlier, which is certainly possible for large-enough contracts

Proposed solution

The idea is to quickly iterate on the new LL+Pratt parser in this plugin not to disturb the main compiler's workflow. It may come without handling comments or very nice error messages, but it will be robust and capable of doing a lot already. And it would be easier to maintain compared to the RegExp one.

Futhermore, it's main aim is to provide a sufficient groundwork to implementing a production-grade one for the Tact compiler and the language server. Until then and beyond that, we'll continue to hone the compiler APIs as they are, of course.

Addtionally, it's worth mentioning that it's already possible to use the extracted language server alongside this plugin and that'll still be possible in the future even when the new parser arrives there as well.

Goals to hit

  • Error-resilience: parser should be able to work with broken code, which is primary state of the code in editors :)
  • Incremental parsing: only new things have to get parsed, not the whole tree every single time
  • Good-enough error reporting: the main thing for editors is fast and up-to-date error-reporting, not the accuracy of them. Although that will be worked on later in the compiler.

P.S.: Easier to start with moving the symbol indexing out of the auto-completion. And using some standard, like LSIF or SCIP (yay!) — https://github.com/sourcegraph/scip. Also, debounce and do updates of that index in the background.

Figure out optimal strategy for version control

For users to be able to specify dev/nightly/main for the latest updates and stable/release (or a particular Tact version tag). Then, update all the plugin configurations in the README.md and in docs, when they arrive in #7.

Otherwise, everyone's going to get the dev Tact syntax, which is ahead of the released ones, because I plan on keeping all the editor integrations of my creation (this one, soon-to-be-made Sublime Text package, and possibly others) and tree-sitter-tact in sync with the main branch of Tact compiler.

UPD: Consider adding a message on start-up if the flag let g:tact_prefer_legacy is not set — "Tact.vim was drastically updated and integrated with an LSP. Please, refer to instructions in README.md on https://github.com/tact-lang/tact.vim"

Can we test the plugin in CI?

A basic test would be to install everything, including Tact and tact.vim and run some command(s) on a sample contract to make sure we have reproducible installation instructions for Linux/Windows/macOS.

And maybe some other tests for plugin functionality would be be great to have.

Idea: Use of tree-sitter-tact or Ohm's grammar

This may help with inference, and thus would remove most of the dirty regex work.

UPD: It should be really done in LSP, then re-used here alongside with the current options (which may then be called "legacy")

Using tact.vim within Nvim

Hi there,

Would you please update README and show instruction for setup it up in Nvim,
specifically by modern package manager like Lazyvim.

Thank you in advance.

Replace echo-like messages for syntax errors with quickfix lists or diagnostic highlights

Tracking issue: prepare for Tact v1.3.0 upon its release

See: https://github.com/tact-lang/tact/blob/main/CHANGELOG.md
Upstream checklist: tact-lang/tact#280

To do:

  • Auto-import all from @stdlib/ownable when @stdlib/stoppable is imported
  • Support escape sequences for strings (highlight them differently)
  • Implicit init function
  • Support trailing commas in all comma-separated lists
  • Add new functions: (log and log2, concat method on StringBuilder, toString method/extension function for Address type, isEmpty and del extension functions for maps),
  • The pow2 power function with base 2
  • The try and try-catch statements
  • Bitwise XOR ^
  • Reserve mode constants (and new lib @stdlib/reserve): ReserveExact, ReserveAllExcept, ReserveAtMost, ReserveAddOriginalBalance, ReserveInvertSign, ReserveBounceIfActionFail.
  • Add missing dumpStack() function
  • Struct & Message field punning
  • ??? tact-lang/tact#79

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.