Skip to content

Commit

Permalink
Properly set textDocumentSync properties of the serverCapabilities (#7)
Browse files Browse the repository at this point in the history
* Properly set textDocumentSync properties of the serverCapabilities

in order to make the LSP work in neovim

* Add release notes

* Add publisher to vscode extension package.json

as demanded by vsce, the extension packaging and publishing tool
  • Loading branch information
mfelsche authored Jul 27, 2024
1 parent 1d5e9bc commit d91cfbb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .release-notes/7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Fix textDocumentSync server capability

Previously the `textDocumentSync` property was malformed and not according to spec.
It seemed vscode did the right thing and fell back to sending both `didChange` and `didSave` notifications anyways.
Neovim didn't, so we didn't receive any `didSave` notifications. Now everything is working as expected with neovim and vscode.
6 changes: 4 additions & 2 deletions client_vscode/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"name": "pony-lsp",
"description": "A Pony language server",
"description": "Ponylang Language Server",
"license": "MIT",
"version": "0.58.4",
"categories": [],
"repository": "https://github.com/kidandcat/pony-language-server",
"repository": "https://github.com/ponylang/pony-language-server",
"publisher": "ponylang",
"displayName": "Ponylang Language Server",
"engines": {
"vscode": "^1.75.0"
},
Expand Down
8 changes: 6 additions & 2 deletions lsp/language_server.pony
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ actor LanguageServer is Notifier
new create(channel': Channel, env': Env, pony_path: String = "") =>
channel'.set_notifier(this)
_channel = channel'
_channel.log("initial PONYPATH: " + pony_path)
_compiler = PonyCompiler(pony_path)
_router = WorkspaceRouter.create()
_env = env'
Expand Down Expand Up @@ -241,8 +242,11 @@ actor LanguageServer is Notifier
// "positionEncoding", "utf-8")(
// we can handle hover requests
"hoverProvider", true)(
// Full sync seems to be needed to receive textDocument/didSave
"textDocumentSync", I64(2))(
"textDocumentSync", Obj(
"change", I64(0))(
"openClose", true)(
"save", Obj("includeText", false))
)(
"definitionProvider", true)(
"documentSymbolProvider", true
).build()
Expand Down
1 change: 1 addition & 0 deletions lsp/workspace/manager.pony
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ actor WorkspaceManager
this._channel.log("No document state found for " + document_path + ". Dunno what to do!")
end
// re-compile changed program - continuing in `done_compiling`
_channel.log("Compiling package " + package.path + " with dependency-paths: " + ", ".join(workspace.dependency_paths.values()))
_compiler.compile(package, workspace.dependency_paths, this)

be hover(document_uri: String, request: RequestMessage val) =>
Expand Down

0 comments on commit d91cfbb

Please sign in to comment.