Skip to content

Commit

Permalink
Fixes #342: Client: duplicate messages sent after server restart
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaeumer committed May 16, 2018
1 parent 6395ec2 commit da31cce
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 9 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ language servers for [VSCode](https://code.visualstudio.com/).

## History

### 4.1.4 Client & 4.1.3 Server

* [Client: duplicate messages sent after server restart](https://github.com/Microsoft/vscode-languageserver-node/issues/342)

### 4.1.1 Client

* [Information on server crash lost as output channel is closed](https://github.com/Microsoft/vscode-languageserver-node/issues/319)
Expand Down
4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vscode-languageclient",
"description": "VSCode Language client implementation",
"version": "4.1.3",
"version": "4.1.4",
"author": "Microsoft Corporation",
"license": "MIT",
"engines": {
Expand All @@ -21,7 +21,7 @@
"vscode": "^1.1.17"
},
"dependencies": {
"vscode-languageserver-protocol": "^3.7.1"
"vscode-languageserver-protocol": "^3.7.2"
},
"scripts": {
"prepare": "npm run update-vscode",
Expand Down
16 changes: 16 additions & 0 deletions client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@ abstract class DocumentNotifiactions<P, E> implements DynamicFeature<TextDocumen
}

public dispose(): void {
this._selectors.clear();
if (this._listener) {
this._listener.dispose();
}
Expand Down Expand Up @@ -906,6 +907,12 @@ class DidChangeTextDocumentFeature implements DynamicFeature<TextDocumentChangeR
}

private callback(event: TextDocumentChangeEvent): void {
// Text document changes are send for dirty changes as well. We don't
// have dirty / undirty events in the LSP so we ignore content changes
// with length zero.
if (event.contentChanges.length === 0) {
return;
}
for (const changeData of this._changeData.values()) {
if (Languages.match(changeData.documentSelector, event.document)) {
let middleware = this._client.clientOptions.middleware!;
Expand Down Expand Up @@ -956,6 +963,9 @@ class DidChangeTextDocumentFeature implements DynamicFeature<TextDocumentChangeR
}

public dispose(): void {
this._changeDelayer = undefined;
this._forcingDelivery = false;
this._changeData.clear();
if (this._listener) {
this._listener.dispose();
this._listener = undefined;
Expand Down Expand Up @@ -1071,6 +1081,7 @@ class WillSaveWaitUntilFeature implements DynamicFeature<TextDocumentRegistratio
}

public dispose(): void {
this._selectors.clear();
if (this._listener) {
this._listener.dispose();
this._listener = undefined;
Expand Down Expand Up @@ -1205,6 +1216,7 @@ class FileSystemWatcherFeature implements DynamicFeature<DidChangeWatchedFilesRe
disposable.dispose();
}
});
this._watchers.clear();
}
}

Expand Down Expand Up @@ -1249,6 +1261,7 @@ export abstract class TextDocumentFeature<T extends TextDocumentRegistrationOpti
this._providers.forEach((value) => {
value.dispose();
});
this._providers.clear();
}
}

Expand Down Expand Up @@ -1290,6 +1303,7 @@ abstract class WorkspaceFeature<T> implements DynamicFeature<T> {
this._providers.forEach((value) => {
value.dispose();
});
this._providers.clear();
}
}

Expand Down Expand Up @@ -2065,6 +2079,7 @@ class ConfigurationFeature implements DynamicFeature<DidChangeConfigurationRegis
for (let disposable of this._listeners.values()) {
disposable.dispose();
}
this._listeners.clear();
}

private onDidChangeConfiguration(configurationSection: string | string[] | undefined): void {
Expand Down Expand Up @@ -2189,6 +2204,7 @@ class ExecuteCommandFeature implements DynamicFeature<ExecuteCommandRegistration
this._commands.forEach((value) => {
value.forEach(disposable => disposable.dispose());
});
this._commands.clear();
}
}

Expand Down
2 changes: 1 addition & 1 deletion jsonrpc/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vscode-jsonrpc",
"description": "A json rpc implementation over streams",
"version": "3.6.1",
"version": "3.6.2",
"author": "Microsoft Corporation",
"license": "MIT",
"repository": {
Expand Down
6 changes: 3 additions & 3 deletions protocol/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vscode-languageserver-protocol",
"description": "VSCode Language Server Protocol implementation",
"version": "3.7.1",
"version": "3.7.2",
"author": "Microsoft Corporation",
"license": "MIT",
"repository": {
Expand All @@ -14,8 +14,8 @@
"main": "./lib/main.js",
"typings": "./lib/main",
"dependencies": {
"vscode-jsonrpc": "^3.6.1",
"vscode-languageserver-types": "^3.7.1"
"vscode-jsonrpc": "^3.6.2",
"vscode-languageserver-types": "^3.7.2"
},
"scripts": {
"prepublishOnly": "npm run compile && npm test",
Expand Down
4 changes: 2 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vscode-languageserver",
"description": "Language server implementation for node",
"version": "4.1.2",
"version": "4.1.3",
"author": "Microsoft Corporation",
"license": "MIT",
"repository": {
Expand All @@ -18,7 +18,7 @@
"typings": "./lib/main",
"dependencies": {
"vscode-uri": "^1.0.1",
"vscode-languageserver-protocol": "^3.7.1"
"vscode-languageserver-protocol": "^3.7.2"
},
"scripts": {
"prepublishOnly": "npm run compile && npm test",
Expand Down
2 changes: 1 addition & 1 deletion types/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vscode-languageserver-types",
"description": "Types used by the Language server for node",
"version": "3.7.1",
"version": "3.7.2",
"author": "Microsoft Corporation",
"license": "MIT",
"repository": {
Expand Down

0 comments on commit da31cce

Please sign in to comment.