8000 Support embedded scopes and scripts · Issue #11 · atom/ide-typescript · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Support embedded scopes and scripts #11

Open
rwatts3 opened this issue Aug 23, 2017 · 12 comments
Open

Support embedded scopes and scripts #11

rwatts3 opened this issue Aug 23, 2017 · 12 comments

Comments

@rwatts3
Copy link
Contributor
rwatts3 commented Aug 23, 2017

This is an html file.

http://nimb.ws/nSAGx4

@rwatts3
Copy link
Contributor Author
rwatts3 commented Aug 23, 2017

Could it be that the getSuggestions logic continues , seeing as though the server is still awaiting... and hasn't had a chance to become null ?

@damieng
Copy link
Contributor
damieng commented Aug 23, 2017

I've put logic into the 0.1.6 update that just went out to avoid the null error - are you using that version or the older one?

For non-JS/TS files getSuggestions should never be called because of this https://github.com/atom/atom-languageclient/blob/master/lib/auto-languageclient.js#L199 so open to ideas on how it's getting there. 😕

@winstliu
Copy link
Contributor

Does the HTML file have script tags? Maybe it's picking up on the embedded JS scopes?

@damieng
Copy link
Contributor
damieng commented Aug 23, 2017

It's possible. The activation grammar checking is based on the top scope of the file - I'm not sure what autoco 8000 mplete does but it's quite possible it's scope based.

The fix that went out should stop the error but there is a larger open question of how LSP deals with scopes and blocks that I haven't seen any answers for. Is a javascript language server expected to be able to deal with html files?

@rwatts3
Copy link
Contributor Author
rwatts3 commented Aug 23, 2017

Yes it does, have script tag, however in the default scopes in main.js getGrammars, source.embedded.html.js is not there. That was a suggestion in a previous ticket I submitted. However that is currently not in place so it shouldn't be the case here.

Hmm @damieng I wonder if the conditional should happen sooner than within getSuggestions ?
Seeing as though in the languageClient we would have already called getSuggestions at this point.

@bennypowers
Copy link

Running JS IDE features in inline scripts is very useful for webcomponent developers

@damieng damieng changed the title Still Seems to be active in non JS/TS Files. Support embedded scopes and scripts Sep 12, 2017
@damieng
Copy link
Contributor
damieng commented Sep 12, 2017

The language server protocol is not clear on what to do about embedded scripts or scopes. Any pointers would be great! :)

@rwatts3
Copy link
Contributor Author
rwatts3 commented Sep 12, 2017

vscode has an html language server as well as ts/js. I'm curious as to how they might be implementing the implementing the inline intellisense.
It could be that they are casting the script block as a virtual js file, then using that as a source of reference. But that is a very wild theory atm.

I'll try to look further if you guys want to collect your findings here as well.

@zhangsiyi
Copy link

How to solve the HTML inline <script> tag does not support tips? I like atom. I need this function!

@bennypowers
Copy link
bennypowers commented Jan 2, 2018

see VSCode: extensions/html/client/src/htmlMain.ts#L52
Where VSCode's HTML extension defines javascript as an embeddedLanguage

and see VSCode: src/vs/workbench/services/textMate/electron-browser/TMSyntax.ts#L389
Where it looks like they're parsing linewise, and if they find javascript, they activate the JS grammar

Is this enough to put together an initial PR? @rwatts3 what do you think?

@damieng
Copy link
Contributor
damieng commented Jan 2, 2018

@bennypowers That covers the activation which I think we could implement. The confusion is whether the typescript language server will be happy receiving HTML files. We could try it and see as the language server protocol has no mention of embedded scripts.

@rwatts3
Copy link
Contributor Author
rwatts3 commented Jan 9, 2018

I wonder if at that point if the lsp has already received the contents of the line ? Would it care about the file at that point. Or if there is anyway we can bypass the file part.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants
0