Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow turning off ERB support through setting #2311

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,11 @@
}
}
}
},
"rubyLsp.erbSupport": {
"description": "Enable ERB support. This can only work with server versions v0.17.5 or above",
"type": "boolean",
"default": true
}
}
},
Expand Down
11 changes: 10 additions & 1 deletion vscode/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
ErrorAction,
CloseAction,
State,
DocumentFilter,
} from "vscode-languageclient/node";

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

const fsPath = workspaceFolder.uri.fsPath.replace(/\/$/, "");
const documentSelector: DocumentSelector = SUPPORTED_LANGUAGE_IDS.map(
let documentSelector: DocumentSelector = SUPPORTED_LANGUAGE_IDS.map(
(language) => {
return { language, pattern: `${fsPath}/**/*` };
},
Expand Down Expand Up @@ -158,6 +159,14 @@ function collectClientOptions(
});
}

// This is a temporary solution as an escape hatch for users who cannot upgrade the `ruby-lsp` gem to a version that
// supports ERB
if (!configuration.get<boolean>("erbSupport")) {
vinistock marked this conversation as resolved.
Show resolved Hide resolved
documentSelector = documentSelector.filter((selector) => {
return (selector as DocumentFilter).language !== "erb";
});
}

return {
documentSelector,
workspaceFolder,
Expand Down
Loading