Matsuuu / custom-elements-language-server

Custom Elements Language Server provides useful language features for Web Components. Features include code actions, completions, diagnostics and more.
BSD 3-Clause "New" or "Revised" License
84 stars 0 forks source link

Sublime Text support #28

Open luwes opened 10 months ago

luwes commented 10 months ago

Support for Sublime Text would be greatly appreciated! Showing my gray hair here 😄

https://lsp.sublimetext.io/language_servers/

Matsuuu commented 10 months ago

From a quick look, doesn't seem like a big hurdle to get the client side setup! Thanks for the link.

I'll aim this for the same release as INTELLIJ compat

Matsuuu commented 10 months ago

Heya @luwes ! I've gotten quite close to supporting sublime, but I'm in need of a little help. What are some tools/packages you use to in Sublime to get some of the highlighting etc. in the template literal / jsx contexts?

I've been able to hook up the system to the editor, but am missing a small part in there, and also am trying to figure out what to set up as a languagetype trigger for the plugin.

Also: Is it common for sublime users to modify their plugin's settings to that they support the filetypes they want? Or is that expected from the plugin authors themselves?

I'll be happy to continue on this after getting some clarity on these. Thanks!

luwes commented 10 months ago

That's great to hear!

ST4 has built-in JSX syntax highlighting and for HTML in template literals I use JS-Custom

My JS-Custom config looks like this to support the /* html */` comment prefixed literal or the html` tagged template

{
  "configurations": {
    "TypeScript": {
      "file_extensions": [ "ts" ],
      "typescript": true,
      "scope": "source.ts",
      "custom_templates": {
        "comments": {
          "css": "scope:source.css",
          "html" : "scope:text.html.basic"
        },
        "tags": {
          "css": "scope:source.css",
          "html": "scope:text.html.basic"
        }
      }
    },
    "TypeScriptJSX": {
      "file_extensions": [ "tsx" ],
      "typescript": true,
      "scope": "source.tsx",
      "jsx": true,
      "custom_templates": {
        "comments": {
          "css": "scope:source.css",
          "html" : "scope:text.html.basic"
        },
        "tags": {
          "css": "scope:source.css",
          "html": "scope:text.html.basic"
        }
      }
    },
    "Template": {
      "string_object_keys": true,
      "custom_templates": {
        "comments": {
          "css": "scope:source.css",
          "html" : "scope:text.html.basic"
        },
        "tags": {
          "css": "scope:source.css",
          "html": "scope:text.html.basic"
        }
      }
    }
  }
}

Also: Is it common for sublime users to modify their plugin's settings to that they support the filetypes they want? Or is that expected from the plugin authors themselves?

I think it's pretty common yes, I've used the scope naming a bunch of times for plugins https://www.sublimetext.com/docs/scope_naming.html#source