Thom1729 / Sublime-JS-Custom

Customizable JavaScript syntax highlighting for Sublime Text.
MIT License
137 stars 9 forks source link

Not sure if it works with LSP #59

Closed gj1118 closed 5 years ago

gj1118 commented 5 years ago

Hi , I am using LSP with my ST. I am using React for my project. When I set Babel to be default source , LSP works but it does not work when I set JS- custom - react .

Can you please let me know what might be an issue here ?

Thanks

nhooyr commented 5 years ago

Its due to styled_components: true. When I turn it off, the typescript plugin starts providing completions for me agin.

nhooyr commented 5 years ago

Its because the root scope on the embedded css becomes source.css.embedded.js. The typescript plugin only provides completions if the root source matches source.js throughout the entire file.

nhooyr commented 5 years ago

@Thom1729 is there an easy way to fix this to make the root scope source.js?

Thom1729 commented 5 years ago

This was broken by #55, which was done because Emmet needs the scopes cleared. The best solution is to revert the behavior, but leave an option to clear all scopes for Emmet users. This turns out to be a bit tricky, because the custom_template_tabs extension takes as its options a dict of tags, leaving no "room" for other options. Fixing this in a backward-compatible answer is surprisingly annoying, but I'm on the path to a solution.

trongthanh commented 4 years ago

Can I reopen this issue? I've tried several ways but still could not have TypeScript language service activated for a JS source file that has styled component or custom tag templates in it.

My JSCustom config:

{
  "defaults": {
    "flow_types": false,
    "jsx": true,
    "eslint_directives": true,
    "custom_templates": {
      "styled_components": true,
      "clear_all_scopes": true,
      "tags": {
        "css": "scope:source.scss",
      }
    }
  }
}

I'm using ST3 Dev build 3210; latest JS Custom cloned from github 2.3.2; TypeScript plugin 3.9.2