Skip to content

Commit 5c94947

Browse files
authored
Merge pull request #84 from krassowski/lsp-ws-connection
Migrate from lsp-editor-adapter to (stripped) lsp-ws-connection.
2 parents a3267f0 + d605ebe commit 5c94947

File tree

6 files changed

+25
-65
lines changed

6 files changed

+25
-65
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"eslint-plugin-prettier": "^3.0.1",
1111
"husky": "^3.0.9",
1212
"javascript-typescript-langserver": "^2.11.3",
13-
"jsonrpc-ws-proxy": "0.0.5",
1413
"lerna": "^3.13.2",
1514
"precise-commits": "^1.0.2",
1615
"prettier": "^1.18.2",

packages/jupyterlab-lsp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
"dependencies": {
4141
"@krassowski/jupyterlab_go_to_definition": "^0.7.1",
42-
"lsp-editor-adapter": "0.0.10"
42+
"lsp-ws-connection": "~0.1.1"
4343
},
4444
"devDependencies": {
4545
"@babel/preset-env": "^7.4.3",

packages/jupyterlab-lsp/src/connection.ts

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
IPosition,
99
ITokenInfo,
1010
LspWsConnection
11-
} from 'lsp-editor-adapter';
11+
} from 'lsp-ws-connection';
1212
import { CompletionTriggerKind } from './lsp';
1313
import { until_ready } from './utils';
1414

@@ -30,24 +30,19 @@ export class LSPConnection extends LspWsConnection {
3030
}
3131

3232
public isRenameSupported() {
33-
// prettier-ignore
3433
return !!(
35-
// @ts-ignore
3634
this.serverCapabilities && this.serverCapabilities.renameProvider
3735
);
3836
}
3937

4038
public rename(location: IPosition, newName: string) {
41-
// @ts-ignore
4239
if (!this.isConnected || !this.isRenameSupported()) {
4340
return;
4441
}
4542

46-
// @ts-ignore
4743
this.connection
4844
.sendRequest('textDocument/rename', {
4945
textDocument: {
50-
// @ts-ignore
5146
uri: this.documentInfo.documentUri
5247
},
5348
position: {
@@ -65,14 +60,10 @@ export class LSPConnection extends LspWsConnection {
6560
super.connect(socket);
6661

6762
until_ready(() => {
68-
// @ts-ignore
6963
return this.isConnected;
7064
}, -1)
7165
.then(() => {
72-
// @ts-ignore
73-
let connection = this.connection;
74-
connection.onClose(() => {
75-
// @ts-ignore
66+
this.connection.onClose(() => {
7667
this.isConnected = false;
7768
this.emit('close', this.closing_manually);
7869
});
@@ -97,26 +88,20 @@ export class LSPConnection extends LspWsConnection {
9788
private _sendChange(
9889
changeEvents: lsProtocol.TextDocumentContentChangeEvent[]
9990
) {
100-
// @ts-ignore
10191
if (!this.isConnected) {
10292
return;
10393
}
104-
// @ts-ignore
105-
let documentInfo = this.documentInfo;
10694
const textDocumentChange: lsProtocol.DidChangeTextDocumentParams = {
10795
textDocument: {
108-
uri: documentInfo.documentUri,
109-
// @ts-ignore
96+
uri: this.documentInfo.documentUri,
11097
version: this.documentVersion
11198
} as lsProtocol.VersionedTextDocumentIdentifier,
11299
contentChanges: changeEvents
113100
};
114-
// @ts-ignore
115101
this.connection.sendNotification(
116102
'textDocument/didChange',
117103
textDocumentChange
118104
);
119-
// @ts-ignore
120105
this.documentVersion++;
121106
}
122107

@@ -126,24 +111,19 @@ export class LSPConnection extends LspWsConnection {
126111
triggerCharacter: string,
127112
triggerKind: CompletionTriggerKind
128113
): Promise<lsProtocol.CompletionItem[]> {
129-
// @ts-ignore
130114
if (!this.isConnected) {
131115
return;
132116
}
133117
if (
134-
// @ts-ignore
135118
!(this.serverCapabilities && this.serverCapabilities.completionProvider)
136119
) {
137120
return;
138121
}
139122

140-
// @ts-ignore
141-
let connection = this.connection;
142123
return new Promise<lsProtocol.CompletionItem[]>(resolve => {
143-
connection
124+
this.connection
144125
.sendRequest('textDocument/completion', {
145126
textDocument: {
146-
// @ts-ignore
147127
uri: this.documentInfo.documentUri
148128
},
149129
position: {

packages/jupyterlab-lsp/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import { IDocumentManager } from '@jupyterlab/docmanager';
1212
import { FileEditorJumper } from '@krassowski/jupyterlab_go_to_definition/lib/jumpers/fileeditor';
1313
import { NotebookJumper } from '@krassowski/jupyterlab_go_to_definition/lib/jumpers/notebook';
1414

15-
import 'codemirror/addon/hint/show-hint.css';
16-
import 'codemirror/addon/hint/show-hint';
15+
// TODO: make use of it for jump target selection (requires to be added to package.json)?
16+
// import 'codemirror/addon/hint/show-hint.css';
17+
// import 'codemirror/addon/hint/show-hint';
1718
import '../style/index.css';
1819

19-
import 'lsp-editor-adapter/lib/codemirror-lsp.css';
2020
import { ICompletionManager } from '@jupyterlab/completer';
2121
import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
2222
import { NotebookAdapter } from './adapters/jupyterlab/notebook';

packages/jupyterlab-lsp/src/virtual/editors/notebook.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Notebook, NotebookPanel } from '@jupyterlab/notebook';
22
import { Cell } from '@jupyterlab/cells';
33
import { CodeMirrorEditor } from '@jupyterlab/codemirror';
4-
import { ShowHintOptions } from 'codemirror';
54
import { IOverridesRegistry } from '../../magics/overrides';
65
import { IForeignCodeExtractorsRegistry } from '../../extractors/types';
76
import { VirtualEditor } from '../editor';
@@ -138,7 +137,6 @@ export class VirtualEditorForNotebook extends VirtualEditor {
138137
return this.get_editor_at_root_line(position);
139138
}
140139

141-
showHint: (options: ShowHintOptions) => void;
142140
state: any;
143141

144142
addKeyMap(map: string | CodeMirror.KeyMap, bottom?: boolean): void {

yarn.lock

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,13 +2142,6 @@
21422142
"@phosphor/signaling" "^1.3.1"
21432143
"@phosphor/virtualdom" "^1.2.0"
21442144

2145-
"@sourcegraph/[email protected]":
2146-
version "0.0.3-fork"
2147-
resolved "https://registry.yarnpkg.com/@sourcegraph/vscode-ws-jsonrpc/-/vscode-ws-jsonrpc-0.0.3-fork.tgz#83728a14616ef0587298e7849d960b61853a9954"
2148-
integrity sha512-EJLq/ni66glk3xYyOZtUIEbjTCw8kMI6RvO0YQtPd+4um2+aTSM1LfN4NrsiVrRkG7EG/U2OkFlKqT8mGo6w4Q==
2149-
dependencies:
2150-
vscode-jsonrpc "^4.0.0"
2151-
21522145
"@types/babel__core@^7.1.0":
21532146
version "7.1.3"
21542147
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.3.tgz#e441ea7df63cd080dfcd02ab199e6d16a735fc30"
@@ -5718,16 +5711,6 @@ jsonparse@^1.2.0:
57185711
resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280"
57195712
integrity sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=
57205713

5721-
5722-
version "0.0.5"
5723-
resolved "https://registry.yarnpkg.com/jsonrpc-ws-proxy/-/jsonrpc-ws-proxy-0.0.5.tgz#e77c4fb4cbeda51a3865eb6314f8deafa8103655"
5724-
integrity sha512-Gz3Njkc4LdJ+wEtrgG5acZWKTH78kYRHCYwN/QKzoJjdQw1jEepwkWTXLRa3JifcIpxh+WjA6OJw8A8RvejzXw==
5725-
dependencies:
5726-
"@sourcegraph/vscode-ws-jsonrpc" "0.0.3-fork"
5727-
js-yaml "^3.12.0"
5728-
minimist "^1.2.0"
5729-
ws "^6.1.0"
5730-
57315714
jsprim@^1.2.2:
57325715
version "1.4.1"
57335716
resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2"
@@ -5868,11 +5851,6 @@ locate-path@^5.0.0:
58685851
dependencies:
58695852
p-locate "^4.1.0"
58705853

5871-
lodash-es@^4.17.11:
5872-
version "4.17.15"
5873-
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.15.tgz#21bd96839354412f23d7a10340e5eac6ee455d78"
5874-
integrity sha512-rlrc3yU3+JNOpZ9zj5pQtxnx2THmvRykwL4Xlxoa8I9lHBlVbbyPhgyPMioxVZ4NqyxaVVtaJnzsyOidQIhyyQ==
5875-
58765854
lodash._reinterpolate@^3.0.0:
58775855
version "3.0.0"
58785856
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
@@ -6005,16 +5983,16 @@ lru-cache@^5.1.1:
60055983
dependencies:
60065984
yallist "^3.0.2"
60075985

6008-
6009-
version "0.0.10"
6010-
resolved "https://registry.yarnpkg.com/lsp-editor-adapter/-/lsp-editor-adapter-0.0.10.tgz#eaaa89e46c71e6856de11fe8cf403b0fbd15c08c"
6011-
integrity sha512-jfAQoakF/K2S0hpN4kQZWRH44Wu7UX0OqJGoUEcm52pBkQxKtCgmRC4EusRHX/wgzDCAJc8zi5fBwYlcqEjwBg==
5986+
lsp-ws-connection@~0.1.1:
5987+
version "0.1.1"
5988+
resolved "https://registry.yarnpkg.com/lsp-ws-connection/-/lsp-ws-connection-0.1.1.tgz#5e259a5079aa91f9bb55453d03df14f3e526fa6b"
5989+
integrity sha512-JLGsBbJc5NlNkvo8hyjVqOG2jZrCtXnz65d1pPPnp6mRl++J3pa0M0e2/jOGeDx+emDNk31/pUlLDOSHhphE4w==
60125990
dependencies:
6013-
lodash-es "^4.17.11"
60145991
vscode-jsonrpc "^4.0.0"
60155992
vscode-languageclient "^5.2.1"
60165993
vscode-languageserver-protocol "^3.14.1"
60175994
vscode-languageserver-types "^3.14.0"
5995+
vscode-ws-jsonrpc "0.1.1"
60185996

60195997
macos-release@^2.2.0:
60205998
version "2.3.0"
@@ -9703,6 +9681,11 @@ vscode-jsonrpc@^4.0.0:
97039681
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-4.0.0.tgz#a7bf74ef3254d0a0c272fab15c82128e378b3be9"
97049682
integrity sha512-perEnXQdQOJMTDFNv+UF3h1Y0z4iSiaN9jIlb0OqIYgosPCZGYh/MCUlkFtV2668PL69lRDO32hmvL2yiidUYg==
97059683

9684+
vscode-jsonrpc@^4.1.0-next:
9685+
version "4.1.0-next.3"
9686+
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-4.1.0-next.3.tgz#05fe742959a2726020d4d0bfbc3d3c97873c7fde"
9687+
integrity sha512-Z6oxBiMks2+UADV1QHXVooSakjyhI+eHTnXzDyVvVMmegvSfkXk2w6mPEdSkaNHFBdtWW7n20H1yw2nA3A17mg==
9688+
97069689
vscode-languageclient@^5.2.1:
97079690
version "5.2.1"
97089691
resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-5.2.1.tgz#7cfc83a294c409f58cfa2b910a8cfeaad0397193"
@@ -9804,6 +9787,13 @@ vscode-uri@^2.1.0:
98049787
resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-2.1.0.tgz#475a4269e63edbc13914b40c84bc1416e3398156"
98059788
integrity sha512-3voe44nOhb6OdKlpZShVsmVvY2vFQHMe6REP3Ky9RVJuPyM/XidsjH6HncCIDdSmbcF5YQHrTC/Q+Q2loJGkOw==
98069789

9790+
9791+
version "0.1.1"
9792+
resolved "https://registry.yarnpkg.com/vscode-ws-jsonrpc/-/vscode-ws-jsonrpc-0.1.1.tgz#163ff05662635b4fd161ed132e112cec4d83f126"
9793+
integrity sha512-1O/FUORbb8dZAvh9AFF6HViLJ0Ja0RbF+sFRnUsoqkuKIRsXDDiiJpwYwT6fmglCLefE5afGPw9NoHvDVN/5yw==
9794+
dependencies:
9795+
vscode-jsonrpc "^4.1.0-next"
9796+
98079797
w3c-hr-time@^1.0.1:
98089798
version "1.0.1"
98099799
resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz#82ac2bff63d950ea9e3189a58a65625fedf19045"
@@ -9994,13 +9984,6 @@ ws@^5.2.0:
99949984
dependencies:
99959985
async-limiter "~1.0.0"
99969986

9997-
ws@^6.1.0:
9998-
version "6.2.1"
9999-
resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb"
10000-
integrity sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==
10001-
dependencies:
10002-
async-limiter "~1.0.0"
10003-
100049987
ws@^7.0.0:
100059988
version "7.2.0"
100069989
resolved "https://registry.yarnpkg.com/ws/-/ws-7.2.0.tgz#422eda8c02a4b5dba7744ba66eebbd84bcef0ec7"

0 commit comments

Comments
 (0)