-
Notifications
You must be signed in to change notification settings - Fork 10
Add server commands #34
Conversation
|
Hi @Jarlakxen. Is this a work in progress? |
|
Hi @laughedelic! The work is done for |
|
Yes, it's better to add all available commands here. There's actually one more command: |
.gitignore
Outdated
|
|
||
| CHANGELOG.md | ||
| coursier | ||
| /bin/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just curious, what do you have there, why do you need to ignore it in every project?
| } | ||
|
|
||
| override def postInitialization(server: ActiveServer): Unit = { | ||
| logger.debug(s"Server Capabilities:\n${js.JSON.stringify(server.capabilities, space = 2)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove debug logging before merging, please. Btw, you can see it in the Atom logs anyway.
|
I think that all this can be drastically simplified: once you got There's a bit tricky part about command names. See Atom docs:
Here's a draft: supportedCommands.foreach { cmd =>
val cmdName = "[A-Z]".r.replaceAllIn(cmd, { "-" + _.group(0).toLowerCase() })
Atom.commands.add("atom-text-editor", s"metals:${cmdName}", { _ =>
server.connection.executeCommand(
new ExecuteCommandParams(command = cmd)
)
})
}@Jarlakxen what do you think about this approach? |
|
From what I understand that could work for |
|
I'm not sure I get it, why does |
|
I saw this part of the code https://github.com/scalameta/metals/blob/master/metaserver/src/main/scala/scala/meta/languageserver/ScalametaServices.scala#L367 and |
|
I see. I think this is also solvable, but let's keep things simple for now and just skip this command:
|
laughedelic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine, except the extra formatting changes. Could you revert them? I'm going to setup a scalafmt config later, so all code will have consistent formatting. Until then I'd like to keep PR changes to the minimum.
It's also strange that the CI is failing, I don't understand what is the problem.. 🤔
|
@Jarlakxen I just tried it out with the latest published server and it seems to work fine. At least I see that it receives the command request. Let's merge it! |
Implemente #27. I putted some of the code in a companion object just to keep the
ScalaLanguageClientclass small.