Closed jfcherng closed 1 year ago
Unfortunately, this won't work for PHP.
Python 3.3>>> from LSP.plugin.core.types import basescope2languageid
Python 3.3>>> basescope2languageid('source.php.embedded.html')
'html'
I notice that
source.php.embedded.html
.source.json.embedded.markdown
.
(https://github.com/sublimehq/Packages/blob/17d27049bcc41cb15561476743462c46968fc82b/Markdown/Markdown.sublime-syntax#L317)So I assume that we have a scoping convention for embedded things: EMBEDDED_LANG.embedded.PARENT_LANG
. Hence we can extract EMBEDDED_LANG
, which we are interested in.
Looks good again.
Fixes https://github.com/TheSecEng/LSP-copilot/issues/33
For example, syntax highlighting for completing JS codes inside Markdown fenced code block.
The main idea is to get the deepest/last
source | text | embedding
scope and find the languageId for it.For the example above, the scope at the cursor is
text.html.markdown markup.raw.code-fence.javascript.markdown-gfm source.js
. We should takesource.js
for resolving languageId rather thantext.html.markdown
.