Skip to content

Commit b92c560

Browse files
authored
Allow turning off ERB support through setting (#2311)
1 parent d3a463f commit b92c560

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

vscode/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,11 @@
418418
}
419419
}
420420
}
421+
},
422+
"rubyLsp.erbSupport": {
423+
"description": "Enable ERB support. This can only work with server versions v0.17.5 or above",
424+
"type": "boolean",
425+
"default": true
421426
}
422427
}
423428
},

vscode/src/client.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
ErrorAction,
2222
CloseAction,
2323
State,
24+
DocumentFilter,
2425
} from "vscode-languageclient/node";
2526

2627
import {
@@ -119,7 +120,7 @@ function collectClientOptions(
119120
const enabledFeatures = Object.keys(features).filter((key) => features[key]);
120121

121122
const fsPath = workspaceFolder.uri.fsPath.replace(/\/$/, "");
122-
const documentSelector: DocumentSelector = SUPPORTED_LANGUAGE_IDS.map(
123+
let documentSelector: DocumentSelector = SUPPORTED_LANGUAGE_IDS.map(
123124
(language) => {
124125
return { language, pattern: `${fsPath}/**/*` };
125126
},
@@ -158,6 +159,14 @@ function collectClientOptions(
158159
});
159160
}
160161

162+
// This is a temporary solution as an escape hatch for users who cannot upgrade the `ruby-lsp` gem to a version that
163+
// supports ERB
164+
if (!configuration.get<boolean>("erbSupport")) {
165+
documentSelector = documentSelector.filter((selector) => {
166+
return (selector as DocumentFilter).language !== "erb";
167+
});
168+
}
169+
161170
return {
162171
documentSelector,
163172
workspaceFolder,

0 commit comments

Comments
 (0)