Closed etherbob closed 1 month ago
Thank you for the bug report!
Let me double-check if I understand the issue correctly. We do want to index all of the files in the workspace you are working on (otherwise your project declarations would not be available for go to definition, hover, etc).
What you're noticing is that BBEdit spawns the language server process using a cwd that isn't the same as the path to your workspace. Is that correct?
If my understanding is right, then we need to pass down the workspace URI used to activate the server during the initialization request to the indexer so that we rely on that instead of Dir.pwd
.
I think so. This is what BBEdit sends on startup.
2024-07-26 15:40:06.478: Initialization parameters sent to server: {
capabilities = {
textDocument = {
codeAction = {
codeActionLiteralSupport = {
codeActionKind = {
valueSet = (
info,
quickfix,
refactor,
source
);
};
};
};
completion = {
completionItem = {
deprecatedSupport = 1;
documentationFormat = (
markdown,
plaintext
);
insertReplaceSupport = 1;
insertTextModeSupport = {
valueSet = (
1,
2
);
};
preselectSupport = 1;
snippetSupport = 1;
};
};
documentSymbol = {
hierarchicalDocumentSymbolSupport = 1;
labelSupport = 1;
};
hover = {
contentFormat = (
markdown,
plaintext
);
};
onTypeFormatting = {
};
publishDiagnostics = {
categorySupport = 1;
codeActionsInline = 1;
codeDescription = 1;
dataSupport = 1;
relatedInformation = 1;
};
rename = {
prepareSupport = 1;
prepareSupportDefaultBehavior = 1;
};
signatureHelp = {
signatureInformation = {
activeParameterSupport = 1;
documentationFormat = (
markdown,
plaintext
);
parameterInformation = {
labelOffsetSupport = 1;
};
};
};
synchronization = {
didSave = 1;
willSave = 1;
};
};
workspace = {
applyEdit = 1;
configuration = 1;
workspaceEdit = {
documentChanges = 0;
failureHandling = abort;
};
workspaceFolders = 1;
};
};
clientInfo = {
name = BBEdit;
version = "15.1.2";
};
initializationOptions = {
diagnostics = 1;
};
rootUri = "file:///Users/username/dev/project/";
trace = verbose;
workspaceFolders = (
{
name = "project";
uri = "file:///Users/username/dev/project/";
}
);
}
Okay, so the workspace URI is "file:///Users/username/dev/project/"
, which surely is the project where you're opening the editor.
To confirm our understanding, can you please edit the Ruby LSP's code in place and print the Dir.pwd
? If our understanding is right and Dir.pwd
does not match the workspace URI, then we identified the issue and I know what the fix is.
BUNDLE_GEMFILE=.ruby-lsp/Gemfile bundle open ruby-lsp
(open the Ruby LSP for editing)$stderr.puts("PWD: #{Dir.pwd}")
PWD:
Probably worth noting this is not in VSCode 2024-08-08 16:54:06.335: stderr output from server: PWD: /Users/username
Sorry, yeah, I said VS Code, but I just cared about the output. Indeed, our understanding was confirmed an BBEdit launches the language server process in a directory that isn't the workspace you are working on.
https://github.com/Shopify/ruby-lsp/pull/2424 will improve the situation, but there is a caveat explanation in the PR.
Description
Reproduction steps
tail -f $HOME/Library/Containers/com.barebones.bbedit/Data/Library/Logs/BBEdit/LanguageServerProtocol-Ruby.txt
Code snippet or error message