Closed tzakharko closed 4 years ago
I think it's just simply not supported.
The code highlighting works as expected, but I don't get the LSP-provided hints.
LSP has nothing to do with syntax highlight at this moment. I believe LSP is bound to a view (I guess) and only takes the top scope (in your case, markdown
's top scope: text.html.markdown
) to determinate which LSP server(s) should be initiated.
Thanks for quick reply! So LSP is not relying on the actual scope but kicks in per-file instead?
If any LSP maintainers are reading this, what would it take for LSP to work per-scope? We are using multi-scope documents a lot and having auto-completion and analysis provided by LSP would be a great thing for us.
LSP, per specification, works per-file. You'd need a server that understands how to handle markdown to have things work the way you want. But I don't think there is a server that handles markdown and also all possible languages embedded in it.
Thanks for pointing this out. I have since learned that R LSP server supports this particular case, there was simply an issue with my config.
fyi: lsp in emacs supports this use case in org mode files (though it is still considered alpha): https://emacs-lsp.github.io/lsp-mode/page/lsp-org/
Cool although looks like a bit gimmicky feature. I would think that many code blocks are snippets that are not necessarily fully semantically correct and not necessarily part of the project's code. I can only see troubles with trying to support that.
Well, in orgmode code blocks can actually be evaluated inside the document for literate programming (https://orgmode.org/worg/org-contrib/babel/intro.html)
But you are probably right for markdown which this issue is about. Just wanted to throw that piece in here for future reference
LSP does not work for me if I have documents with mixed scopes, such as code blocks within markdown documents. Specifically, I was playing around with Rmarkdown style documents, where you mix free text (using markdown) and data analysis code (using fenced code blocks). The code highlighting works as expected, but I don't get the LSP-provided hints. LSP works if I edit a standalone R file. I am a new Sublime user, so maybe my setup is wrong?