Skip to content

Commit 26cb8fb

Browse files
authored
Merge pull request #858 from krassowski/bump-webpack-in-ws-lsp-connection
Bump webpack in ws lsp connection
2 parents 36314ae + 6324606 commit 26cb8fb

File tree

8 files changed

+80
-1283
lines changed

8 files changed

+80
-1283
lines changed

binder/postBuild

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
#!/usr/bin/env bash
22
set -eux
33

4-
# Avoid OpenSSL error when Node.js > 16
5-
# https://stackoverflow.com/questions/73144960
6-
nodeversion="$(node -v | cut -d 'v' -f 2 | cut -d '.' -f 1)"
7-
if (( "$nodeversion" > 16 ))
8-
then
9-
export NODE_OPTIONS="--openssl-legacy-provider"
10-
fi
11-
124
# Build labextensions
135
jlpm bootstrap
146

packages/jupyterlab-lsp/jest.config.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const upstream = func('jupyterlab-lsp', __dirname);
44
const reuseFromUpstream = [
55
'moduleFileExtensions',
66
'moduleNameMapper',
7-
'setupFiles',
87
'setupFilesAfterEnv',
98
'testPathIgnorePatterns'
109
];
@@ -28,7 +27,11 @@ let local = {
2827
},
2928
transformIgnorePatterns: [`/node_modules/(?!${esModules}).+`],
3029
testLocationInResults: true,
31-
reporters: [...upstream['reporters'], 'jest-github-actions-reporter']
30+
reporters: [...upstream['reporters'], 'jest-github-actions-reporter'],
31+
setupFiles: [
32+
...upstream['setupFiles'],
33+
'@krassowski/jupyterlab-lsp/lib/jest-shim.js'
34+
]
3235
};
3336

3437
for (const option of reuseFromUpstream) {

packages/jupyterlab-lsp/src/connection.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ export class LSPConnection extends LspWsConnection {
452452
method,
453453
message: params
454454
});
455-
this.connection.sendNotification(method, params);
455+
this.connection.sendNotification(method, params).catch(console.error);
456456
});
457457
}
458458

@@ -618,10 +618,9 @@ export class LSPConnection extends LspWsConnection {
618618
} as lsp.VersionedTextDocumentIdentifier,
619619
contentChanges: changeEvents
620620
};
621-
this.connection.sendNotification(
622-
'textDocument/didChange',
623-
textDocumentChange
624-
);
621+
this.connection
622+
.sendNotification('textDocument/didChange', textDocumentChange)
623+
.catch(console.error);
625624
documentInfo.version++;
626625
}
627626

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// TODO: remove after upgrading to JupyterLab 4.0
2+
const util = require('util');
3+
(global as any).TextDecoder = util.TextDecoder;
4+
(global as any).TextEncoder = util.TextEncoder;

packages/lsp-ws-connection/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@
2727
"homepage": "https://github.com/krassowski/jupyterlab-lsp/tree/master/packages/lsp-ws-connection",
2828
"repository": "github:krassowski/jupyterlab-lsp",
2929
"dependencies": {
30-
"vscode-jsonrpc": "^6.0.0",
3130
"vscode-languageserver-protocol": "^3.16.0",
3231
"vscode-languageserver-types": "^3.16.0",
33-
"vscode-ws-jsonrpc": "0.2.0"
32+
"vscode-ws-jsonrpc": "~1.0.2"
3433
},
3534
"devDependencies": {
3635
"@types/chai": "^4.1.7",
@@ -43,7 +42,7 @@
4342
"rimraf": "^3.0.2",
4443
"sinon": "^7.3.2",
4544
"typescript": "~4.1.3",
46-
"webpack": "^4.32.2",
47-
"webpack-cli": "^3.3.0"
45+
"webpack": "^5.54.0",
46+
"webpack-cli": "^4.1.0"
4847
}
4948
}

packages/lsp-ws-connection/src/ws-connection.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export class LspWsConnection
186186
version: documentInfo.version
187187
} as protocol.TextDocumentItem
188188
};
189-
this.connection.sendNotification(
189+
void this.connection.sendNotification(
190190
'textDocument/didOpen',
191191
textDocumentMessage
192192
);
@@ -209,7 +209,7 @@ export class LspWsConnection
209209
} as protocol.VersionedTextDocumentIdentifier,
210210
contentChanges: [{ text: documentInfo.text }]
211211
};
212-
this.connection.sendNotification(
212+
void this.connection.sendNotification(
213213
'textDocument/didChange',
214214
textDocumentChange
215215
);
@@ -228,7 +228,7 @@ export class LspWsConnection
228228
} as protocol.VersionedTextDocumentIdentifier,
229229
text: documentInfo.text
230230
};
231-
this.connection.sendNotification(
231+
void this.connection.sendNotification(
232232
'textDocument/didSave',
233233
textDocumentChange
234234
);
@@ -241,7 +241,7 @@ export class LspWsConnection
241241
return;
242242
}
243243

244-
this.connection.sendNotification(
244+
void this.connection.sendNotification(
245245
'workspace/didChangeConfiguration',
246246
settings
247247
);
@@ -606,8 +606,8 @@ export class LspWsConnection
606606
protected onServerInitialized(params: protocol.InitializeResult) {
607607
this.isInitialized = true;
608608
this.serverCapabilities = params.capabilities;
609-
this.connection.sendNotification('initialized', {});
610-
this.connection.sendNotification('workspace/didChangeConfiguration', {
609+
void this.connection.sendNotification('initialized', {});
610+
void this.connection.sendNotification('workspace/didChangeConfiguration', {
611611
settings: {}
612612
});
613613
this.emit('serverInitialized', this.serverCapabilities);

packages/lsp-ws-connection/webpack.config.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ module.exports = {
66
index: './lib/index.js'
77
},
88
resolve: {
9-
extensions: ['.js']
9+
extensions: ['.js'],
10+
fallback: {
11+
net: false,
12+
path: false,
13+
crypto: false
14+
}
1015
},
1116
target: 'web',
12-
node: {
13-
net: 'mock'
14-
},
1517
output: {
1618
filename: '[name].js',
1719
path: path.resolve(__dirname, 'dist'),

0 commit comments

Comments
 (0)