A diff for when LSP might remove the "syntaxes" key
rwols opened this issue · 2 comments
rwols commented
I have a pull request for removing the "syntaxes" key over at the LSP package.
This helper package breaks when that PR is merged into master.
Please don't apply this patch until sublimelsp/LSP#931 is in the master branch (that could take a while, since ST4 isn't even out of alpha yet).
diff --git a/plugin.py b/plugin.py
index 3e68a56..31668e5 100644
--- a/plugin.py
+++ b/plugin.py
@@ -48,13 +48,7 @@ class LspMetalsPlugin(LanguageHandler):
name=server_name,
binary_args=launch_command,
tcp_port=None,
- languages=[
- LanguageConfig(
- "scala",
- ["source.scala"],
- ["Packages/Scala/Scala.sublime-syntax"]
- )
- ],
+ languages=[LanguageConfig("scala")],
enabled=True,
init_options=dict(),
settings=dict(),
rwols commented
This should work for both ST3 and ST4:
diff --git a/plugin.py b/plugin.py
index 626cc2d..7948d67 100644
--- a/plugin.py
+++ b/plugin.py
@@ -55,17 +55,21 @@ class LspMetalsPlugin(LanguageHandler):
if java_path is None:
sublime.error_message(missing_java_home)
+ try:
+ # ST4
+ language = LanguageConfig("scala")
+ except TypeError:
+ # ST3
+ language = LanguageConfig(
+ language_id="scala",
+ scopes=["source.scala"],
+ syntaxes=["Packages/Scala/Scala.sublime-syntax"])
+
metals_config = ClientConfig(
name=server_name,
binary_args=launch_command,
tcp_port=None,
- languages=[
- LanguageConfig(
- "scala",
- ["source.scala"],
- ["Packages/Scala/Scala.sublime-syntax"]
- )
- ],
+ languages=[language],
enabled=True,
init_options=dict(),
settings=dict(),
rwols commented
You may want to apply this last patch because I merged the PR into st4000-exploration.