3 ms·
Will tree sitter also stimulate creation of free tools which work on the AST? E.g. it's a mystery to me why we don't have free refactoring tools like the ones
by dmortin 7y ago
Will tree sitter also stimulate creation of free tools which work on the AST?
E.g. it's a mystery to me why we don't have free refactoring tools like the ones in IntelliJ. Like some free library which could extract methods, rename variables, etc. by modyfing the AST. It does not seem too hard.
Is it because the current AST parsers are not fast enough or is there some other reason?
- adamsmith 7y agoYou need semantic understanding to do several of those operations. Parsing often isn’t sufficient.
- dmortin 7y agoYes, but semantic understanding is not really complicated for rename variable, for example, so it's strange there is no library which can do that.
- lioeters 7y agoFrom my limited knowledge/experience, the use of language server protocol (like in VS Code editor) enables refactoring operations like you describe, for example, in TypeScript it can create a struct out of function parameters, or create a class from old function-prototype based definitions. Compared to IDEs like IntelliJ, though, I imagine the feature set is much, much smaller in scope. I did see some discussion about integrating tree-sitter with VS Code, but the focus seems limited to syntax highlighting, not operating on ASTs.
- lioeters 7y agoI found that the last time this talk was posted on HN [0], the author of tree-sitter mentioned that a couple of language servers are indeed using tree-sitter. * Bash - https://github.com/mads-hartmann/bash-language-server https://github.com/mads-hartmann/bash-language-server * Ruby - https://github.com/rubyide/vscode-ruby/tree/master/server https://github.com/rubyide/vscode-ruby/tree/master/server [0] https://news.ycombinator.com/item?id=18213022 https://news.ycombinator.com/item?id=18213022