Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
Add gem paths to document selector patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistock committed Feb 9, 2024
1 parent f941025 commit aaf2c0f
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ function collectClientOptions(
configuration: vscode.WorkspaceConfiguration,
workspaceFolder: vscode.WorkspaceFolder,
outputChannel: WorkspaceChannel,
ruby: Ruby,
): LanguageClientOptions {
const pullOn: "change" | "save" | "both" =
configuration.get("pullDiagnosticsOn")!;
Expand All @@ -102,10 +103,27 @@ function collectClientOptions(

const features: EnabledFeatures = configuration.get("enabledFeatures")!;
const enabledFeatures = Object.keys(features).filter((key) => features[key]);
const pattern = `${path.join(workspaceFolder.uri.fsPath, "**", "*")}`;

const documentSelector = [
{
language: "ruby",
pattern: path.join(workspaceFolder.uri.fsPath, "**", "*"),
},
];

if (ruby.env.GEM_PATH) {
const parts = ruby.env.GEM_PATH.split(path.delimiter);

parts.forEach((gemPath) => {
documentSelector.push({
language: "ruby",
pattern: path.join(gemPath, "**", "*"),
});
});
}

return {
documentSelector: [{ language: "ruby", pattern }],
documentSelector,
workspaceFolder,
diagnosticCollectionName: LSP_NAME,
outputChannel,
Expand Down Expand Up @@ -149,6 +167,7 @@ export default class Client extends LanguageClient implements ClientInterface {
vscode.workspace.getConfiguration("rubyLsp"),
workspaceFolder,
outputChannel,
ruby,
),
);

Expand Down

0 comments on commit aaf2c0f

Please sign in to comment.