Alternate to org.eclipse.glsp.server.features.directediting.ApplyLabelEditOperation #649
-
I am using GLSP's vscode intergration project. Also, I am using Xtext with a language sever and language client(Generating diagrams using GLSP). Data required to generate graph will be provided by language server. I want to implement label editing. In case of GLSP when we try to edit diagram element's label, org.eclipse.glsp.server.features.directediting.ApplyLabelEditOperation will be sent to server from the client where we will update GLabel's text. My requirement: Language resource's element corresponding to edited diagram element need to be updated. I want to know if there are any other ways to implement my requirement. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I can think of three ways to address this requirement:
export const yourModule = new ContainerModule((bind, _unbind, isBound) => {
configureActionHandler({ bind, isBound }, ApplyLabelEditOperation.KIND, ApplyLabelEditOperationHandler);
});
@injectable()
export class ApplyLabelEditOperationHandler implements IActionHandler {
handle(action: Action): void | Action | ICommand {
console.log('Do what you have to do');
}
}
...
export default function createContainer(widgetId: string): Container {
const container = createClientContainer(yourDiagramModule, yourApplyLabelEditModule);
...
}
|
Beta Was this translation helpful? Give feedback.
-
@planger , Thank you, I am able to implement diagram editing using approach 1. |
Beta Was this translation helpful? Give feedback.
I can think of three ways to address this requirement:
In use cases like you have, we would typically have a connection from the GLSP server to your language server, so that you can query its internal state, like the AST, using custom operations and then create a diagram from it. If you have the language server connection, you could invoke the rename method in the language server also from the GLSP server.
Register an additional action handler on the client that reacts to
ApplyLabelEditOperation
and then call the language server from there. On the GLSP server, just register a noop for the label editing handler. This would look something like the following in the client code: