5 ms·
I clicked through to the point of skimming the documentation for tree-sitter before giving up on understanding this quickly. There are too many components that
by alsetmusic 6y ago
I clicked through to the point of skimming the documentation for tree-sitter before giving up on understanding this quickly. There are too many components that I haven’t seen for me to extrapolate out and get to what this does in general terms.
Could anyone with more knowledge please explain what this is and how one might utilize it? Fwiw, I’m deeply familiar with Bash; I just don’t recognize the rest.
- sabellito 6y agoLanguage Servers are pieces of software that implement IDE-like features (like go to definition, find usages, call-hierarchy, rename method, etc) for a given language in an editor-agnostic way. With that, any editor that supports Language Servers can use those to provide better support to a language without implementing any details. In this case, you can see some of the supported editors in the README itself: https://github.com/bash-lsp/bash-language-server#clients https://github.com/bash-lsp/bash-language-server#clients
- benatkin 6y agoIt doesn't seem editor agnostic to me. It seems geared towards vscode. The idea is also not new - python has had docstrings since the 90s. They never thought to show the full definition on hover or autocomplete, probably because it's noise most of the time, but a lot of people seem to like it.
- zeusk 6y agoLSP is a protocol for IDE/editors to analyze code files and provide functionality like intelligible code search (definition, references etc)
- benatkin 6y agoArguably a protocol for Visual Studio Code to...
- chusk3 6y agoThat's simply not true; there are LSP client implementations/integrations for vim, neovim, emacs, sublime text, web environments like gitpod.io, Eclipse IDE (via Theia IDE), Jetbrains supports it in their IDEs, and Visual Studio even has some level of support for it. LSP is _the_ way to write IDE integrations in the modern era. (I maintain LSP tooling for F# and actively support at least half of the editors above)
- deleted 6y ago[deleted]
- benatkin 6y agoIt's neither true nor false, it's an opinion. Sure "LSP" has support built in or tacked on (as plugins), mostly tacked on, to other editors. Nobody is required to assume TypeScript docs for a supposedly language-agnostic protocol, or that particular flavor of JSON-RPC, or JSON-RPC, or even JSON. And the pill I don't want to swallow, that people using LSP tend to swallow, is getting full definitions with autocomplete, or hover. Most of the time I prefer to just see completions when I autocomplete, not full definitions. It is clutter.
- chusk3 6y agoI'm not at all sure what you mean by 'typescript docs' in your comment. The protocol for things like tooltips/signature completion literally just says 'put arbitrary markdown here'. It doesn't proscribe the structure of the text the LSP author decides to use. There are also many different display/view methods that more sophisticated LSP implementations can implement. In my own LSP, we have different 'views' of the signatures/types/docs for * hovers * signature completion * detailed type-level embedded docs in a separate pane to name a few. It's entirely customizable.
- benatkin 6y agoThe official docs for LSP express the format in TypeScript rather than plain english or something like JSON schema. https://microsoft.github.io/language-server-protocol/specifications/specification-current/ https://microsoft.github.io/language-server-protocol/specifi... If it pointed to TypeScript docs to brush up on it that would be one thing but it assumes TypeScript knowledge.
- deleted 6y ago[deleted]
- adonovan 6y agoLanguage Server Protocol (LSP) is a standard protocol for "plain old" editors (clients) to make RPCs to local processes that understand the syntax, references, and types of a particular programming language (servers). This reduces the work to support M servers and N clients to M+N, whereas the traditional monolithic approach required M*N integrations. This particular project adds a server for Bash support.
- JoBrad 6y agoTo add to the other comments, VSCode docs has a good overview of the motivation and usage of a Language Server. https://code.visualstudio.com/api/language-extensions/language-server-extension-guide https://code.visualstudio.com/api/language-extensions/langua...
- widdershins 6y agoThe other comments explained what LSP is - I'll explain what tree-sitter is. It's a clever parser that is very fast when it comes to reparsing a slightly changed file (it's 'incremental'). It's also very good at handling errors and continuing to parse your file. You write a grammar in json and it gets compiled to a shared library via C.