scalameta / metals-sublime Goto Github PK
View Code? Open in Web Editor NEWSublime Text package for Metals, a language server for Scala
Home Page: https://packagecontrol.io/packages/LSP-metals
License: Apache License 2.0
Sublime Text package for Metals, a language server for Scala
Home Page: https://packagecontrol.io/packages/LSP-metals
License: Apache License 2.0
Relates to:
Once scalameta/metals#3996 is merged
Required for java 17 hover support. Ref scalameta/metals-vscode#1395
Hello.
I am using ubuntu 20.04 LTS x86_64 and here are other specs:
Scala code runner version 2.13.6 -- Copyright 2002-2021, LAMP/EPFL and Lightbend, Inc.
java 11.0.10 2021-01-19 LTS (oracle Java)
Java(TM) SE Runtime Environment 18.9 (build 11.0.10+8-LTS-162)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.10+8-LTS-162, mixed mode)
sbt --version
sbt version in this project: 1.5.4
sbt script version: 1.5.4
and sublime text with sublimelsp/LSP and scalameta/metals-sublime
the problem is this :
while building by shift+f10 is get this message you are using scala 2.12.14 which is not yet supported in this version of metals please downgrade to scala version 2.12.12 for the moment until the new metal release.
as you can see in the "http://127.0.0.1:5031/doctor" print out below I am using 2.13.
I don't know how to fix this issue.
thanks for you help.
How to build the code use metals in sublime text?
The docker run results are all green
Setting the command
should be done in can_start
I just installed and configured Metals in Sublime Text yesterday and I've found that Metals Doctor opens far more frequently than I'd expect. I'm not exactly sure what triggers it to open, but it often seems to happen after switching between git
branches or after opening a .scala
file in a different SBT sub-project.
Is there anything I can do to prevent this from opening except when I explicitly choose to run it from the command palette?
https://scalameta.org/metals/docs/editors/new-editor.html#goto-location
The goal is to improve this use case scalameta/metals#1599
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(),
Line 58 in f41e27e
Why is it not enabled by default?
I think I lot of people would expect something to be enabled, rather the disabled, when installing something? :)
If it is enabled, that one step less that a user need to do :)
3.Enable "metals-sublime" in your scala project
As suggested by https://scalameta.org/metals/blog/2022/01/12/aluminium#basic-java-support, Metals 0.11 adds support for Java build targets. I think it would be great if we could activate Metals for Java plugins, as currently that's not the case and one cannot find and run any of the Metals commands in Java files. Looks related to #77 but only superficially.
As a follow-up to scalameta/metals#2391, the NPE should be avoided now and a message shown if a user just opens up a Scala file. However, without having any rootUri
set, a lot of the functionality that is possible won't happen. I'm curios how much of the LSP api from the LSP package is exposed and if it's possible to detect if no root is there, just set the parent as the root. I know Neovim makes this super easy, as you can see here. Would this at all be possible in the Sublime extension until we do a proper refactoring on the Metals side to handle this case?
I'm using the latest Metals Sublime release with the latest Sublime Text release (Build 4116) and I'm getting the following errors in the Metals server log panel:
metals: 2021.10.01 14:18:10 WARN Unexpected notification params received for didFocusTextDocument: {uri=file:///Users/jvicentecantero/Code/???}
This suggests that we're not sending the didFocusTextDocument
well to the Metals server and it's potentially causing misbehaviors on the server. Looks like we might need to change the ST4 implementation here
metals-sublime/st4/LspMetalsFocus.py
Lines 9 to 33 in b95de4f
@ayoub-benali You're the last person that made the change, do you know what might be going on? Also, I've experienced cases where Metals is not publishing compilation errors for files that are not open. Every time it's happened has been annoying and unpredictable. I'm not sure if this is connected to that issue, but you might want to know about it. Let me know if you have any ideas here because I'd be willing to invest some time fixing the issue with missing diagnostics.
scalameta/metals#1031 was recently merged which adds an "implement all members" completion similar to how the exhaustive match is done. However, in Sublime it seems to not show up in the same order in the completions as the other editors. It seems to be triggered by e
for some reason. Also, when you select the completion, it puts in the literal text as seen in the gif below.
Version of Metals: Latest Snapshot - 0.7.6+224-b3ea857f-SNAPSHOT
the plugin lsp-metals
v0.17.1 does not display worksheet results inline. However the compilation & auto-completion features works.
The plugin runs in the following error each time worksheet is evaluated.
Error handling notification
Traceback (most recent call last):
File "/data/sysconfigs/sublime-text/Installed Packages/LSP.sublime-package/plugin/core/sessions.py", line 1987, in on_payload
handler(result)
File "/data/sysconfigs/sublime-text/Packages/LSP-metals/core/metals.py", line 77, in m_metals_publishDecorations
handle_decorations(session, decorationsParams)
File "/data/sysconfigs/sublime-text/Packages/LSP-metals/core/decorations.py", line 62, in handle_decorations
phantom_set.update(phantoms)
File "/data/cellar/sublime_text/Lib/python33/sublime.py", line 1897, in update
new_phantoms = {p.to_tuple(): p for p in new_phantoms}
File "/data/cellar/sublime_text/Lib/python33/sublime.py", line 1897, in <dictcomp>
new_phantoms = {p.to_tuple(): p for p in new_phantoms}
File "/data/sysconfigs/sublime-text/Packages/LSP-metals/core/decorations.py", line 107, in <lambda>
return map(lambda o: decoration_to_phantom(o, view), options)
File "/data/sysconfigs/sublime-text/Packages/LSP-metals/core/decorations.py", line 91, in decoration_to_phantom
point = view.text_point(option['start'].row, option['start'].col)
KeyError: 'start'
Example here: scalameta/nvim-metals#321
This file is editable by the user to tweak Metals behavior but it should not contain things like initializationOptions
and other internal values
Accept latest-stable
or latest-snapshot
as server version and fetch version number from maven like scalameta/nvim-metals#276
This plugin is now in the default repository of package control.
Sublime text editor crashes when evaluating large output for e.g
the below code snippet when evaluated would crash the editor
import scala.collection.mutable.ListBuffer
import java.util.{ArrayList => jal}
val lb = ListBuffer[String]()
lb += "a"
lb += "b"
val jl = new jal[String]()
jl.add("a")
jl.add("b")
val x = 90
x + 1
val b = (1 to 5000).toList.foreach(x => (1 to x).foreach(println))
I'm using LSP v1.27.0 and LSP-metals v0.17.6 in Sublime Text build 4169 on Mac OS Sonoma 14.1.1.
I'm seeing the following message: "You are using Scala version 2.13.12, which is not yet supported in this version of Metals. ..." Per https://scalameta.org/metals/blog/2023/07/19/silver, there is a line of Metals versions beyond 0.11.12 - there are versions 1.0 through 1.2. Are those versions not supported through Sublime? Is there a timeframe / ETA for supporting them?
Thank you
https://scalameta.org/metals/blog/2021/05/17/tungsten#rename-file-as-class
Requires upstream support of resourceOperationKind in LSP
Requires:
debug-adapter-start
commandIt would nice to get this working as well https://scalameta.org/metals/blog/2020/11/20/lithium/#navigating-stacktrace
@olafurpg Following your proposal here
Shall we assume that coursier is installed and available in the classpath ? like in the vscode plugin?
Or should we embed some kind of coursier luncher like here https://github.com/tomv564/LSP-dotty
How are the server updates handled in the vscode plugin ? do you have to change the version by hand every time there is a server release ?
Just want to understand and document what is the expected workflow
cc @gabro
In metals 0.10.8, there's a new feature:
https://scalameta.org/metals/blog/2021/10/26/tungsten#type-annotations-on-code-selection.
when i open a folder, the import prompt doesn't show up automatically.
Since scalameta/metals#3631 artifacts are published for 2.13 instead of 2.12. So this is needed at least for the new snapshots
See https://scalameta.org/metals/docs/integrations/new-editor#metalsdoctorvisibilitydidchange
This is currently blocked by some API limitation on the sublime side. For example there is no way to know when Doctor view is closed
Hey folks ๐ I'd like to report a bug I run into often when using this plugin.
Here's a quick reproduction video.
The weird thing is that sometimes the right symbol is imported and sometimes it isn't. However, this happens often enough in my computer to be an annoying behavior that gets in the way of my coding flow.
I haven't had a look at the implementation, but my guess would be that there's some reordering of the results either on the client or server side and the index sent by the Sublime Text client doesn't match the one in the server.
like bsp-switch
and generate-bsp-config
reported here #7
Requires this upstream fix first
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.