-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Consider executeCommandProvider for multi server #45
Comments
@mtsmfm Can you provide some more context please? Is |
@jrieken Sorry for being late. I created an example extension to describe this problem: Please try this extension with https://github.com/mtsmfm/example-workspace This extension just inserts workspace folder name as a code action. |
Actually, we can't notice this error normally because it's suppressed in this line: |
@jrieken Isn't this explanation enough? |
@jrieken I guess you're busy though, could you have a look at this? |
I just ran into this, been using a multi-server LSP setup following the example here without realising the major limitation that it won't even initialize if it contains an (My plan is to avoid |
I think this should be related to this one. What I've ended up doing is using a global async function registerHiePointCommand(name: string,
command: string,
context: ExtensionContext) {
const editorCmd = commands.registerTextEditorCommand(name, (editor, edit) => {
const cmd = {
command,
arguments: [
{
file: editor.document.uri.toString(),
pos: editor.selections[0].active,
},
],
};
// Get the current file and workspace folder.
const uri = editor.document.uri;
const folder = workspace.getWorkspaceFolder(uri);
// If there is a client registered for this workspace, use that client.
if (clients.has(folder.uri.toString())) {
const client = clients.get(folder.uri.toString());
client.sendRequest('workspace/executeCommand', cmd).then(hints => {
return true;
}, e => {
console.error(e);
});
}
});
context.subscriptions.push(editorCmd);
} It gets the current file, then looks up the workspace folder. It uses this Then to get rid of the |
Thank you for the giving awesome samples.
How can we implement multi server with
executeCommandProvider
?I met
command already exists
error.https://github.com/Microsoft/vscode/blob/8e0baeddeb7ba1b563233335bc28e37163669747/src/vs/workbench/api/node/extHostCommands.ts#L65
The text was updated successfully, but these errors were encountered: