Skip to content

Commit 63c52b9

Browse files
authored
Merge pull request #763 from the-mikedavis/md-check-dynamic-registration-capability
server: Only perform dynamic registration if client supports it
2 parents eed44dd + 8d7258e commit 63c52b9

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

server/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Bash Language Server
22

3+
## 4.8.3
4+
5+
- Skip sending a `client/registerCapability` request when dynamic capability registration is not supported by the client https://github.com/bash-lsp/bash-language-server/pull/763
6+
37
## 4.8.2
48

59
- ShellCheck: avoid using the diagnostic tag "deprecated" that allow clients to render diagnostics with a strike through https://github.com/bash-lsp/bash-language-server/pull/753

server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "A language server for Bash",
44
"author": "Mads Hartmann",
55
"license": "MIT",
6-
"version": "4.8.2",
6+
"version": "4.8.3",
77
"main": "./out/server.js",
88
"typings": "./out/server.d.ts",
99
"bin": {

server/src/server.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ export default class BashServer {
138138
*/
139139
public register(connection: LSP.Connection): void {
140140
const hasConfigurationCapability = !!this.clientCapabilities?.workspace?.configuration
141+
const canDynamicallyRegisterConfigurationChangeNotification =
142+
!!this.clientCapabilities?.workspace?.didChangeConfiguration?.dynamicRegistration
141143

142144
let currentDocument: TextDocument | null = null
143145
let initialized = false // Whether the client finished initializing
@@ -190,9 +192,11 @@ export default class BashServer {
190192

191193
if (hasConfigurationCapability) {
192194
// Register event for all configuration changes.
193-
connection.client.register(LSP.DidChangeConfigurationNotification.type, {
194-
section: CONFIGURATION_SECTION,
195-
})
195+
if (canDynamicallyRegisterConfigurationChangeNotification) {
196+
connection.client.register(LSP.DidChangeConfigurationNotification.type, {
197+
section: CONFIGURATION_SECTION,
198+
})
199+
}
196200

197201
// get current configuration from client
198202
const configObject = await connection.workspace.getConfiguration(

0 commit comments

Comments
 (0)