Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[lsp4e-dev] Command handler dispatch: undo not working following upgrade - any ideas?
  • From: Ahmed Hussain <ahmed@xxxxxxxxxx>
  • Date: Wed, 14 Aug 2024 14:46:52 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cocotec.io; dmarc=pass action=none header.from=cocotec.io; dkim=pass header.d=cocotec.io; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Y8Z4YJAdxFUPCh+Fy98qgiMmFb5JxqxFQS+UWx086KM=; b=timuvwk9mIInIrw7ViqaRw9zopAe/kHidOsWfhyt8ZcNALkFZAn8GzYDERgrzGq3XNhTcJUkWc5oESpf6CwBzz7Sa0siAk9bVfdJmrYDLHBB8e4XfMYQXHkrTkB7RneiqKnVtyG7SAw3m+XP3PJqc6FUB8dRD/C7Macx9XIVYr/OSM7FzM3ajgLhRo4XMnQi0ICmlZ+YwXvcWFQjZNZ/9X4ODjgQaIP8QEQ7puaQUsuz3GeEKFa7qBpZOLG878lgTiSHubz/e10AiY8nhTozIKJTUtzmmRcRXhPW3IK7DAv9KFCvvZ8voQxpvL50NPNpsMGQMjG7dH7nHWnv7aw/rQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=grQDcuMoUvw7uWOwzsIt9Ngbuxw3AMjzt3OcIJ1c/ey8X6qHZj/RvrXB741hF4Eqn5i5I4ZJ788zt/kYaInR9t3e7WqA44ThRxYFhFGQjPetsYpBjSAt+q/Ki0cm7cGwNmaAqE/GO8pFUW5QvFuqUxswzI2RSDVxhIgISrKMjwzeXXP4UzIVTn4vsVWAqMvKXsAGwf7Ujz/jo8SMprS2hB/bwWNKdJlVAyXF0PD0pqIVcT7GQlGYdV6okpc+JtuRvQLXpZqaFWIVQgqfjVdxLd3D0ByHL9GAEaKkx/GS0/crA1e2MrCY7rOX2WPV1Tdfl5iM7R+RGFacaa1sCxW6fA==
  • Delivered-to: lsp4e-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/lsp4e-dev/>
  • List-help: <mailto:lsp4e-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/lsp4e-dev>, <mailto:lsp4e-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/lsp4e-dev>, <mailto:lsp4e-dev-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AQHa7ljMwjcBEQOESUmJ/ZhomPmJ1Q==
  • Thread-topic: Command handler dispatch: undo not working following upgrade - any ideas?

Hi all,

Apologies if this isn’t the right place to ask, but just on the off-chance an Eclipse guru out there might know where best to dig…

Recently upgraded to using the very latest lsp4e directly, whereas before we used to shade our own copy with our own plugin & extension point namespace. Finally got to the point where we can consume unmodified production lsp4e directly - hurray! We’ve also switched to using tm4e.

Following the recent upgrade to production lsp4e, we’ve had a seriously inconvenient bug where undo stops working properly. 

Scenario:

1. Open an editor for our file type - undo works fine.
2. Open a second editor for another file of the same type - undo works fine, but stops working in the first editor.
3. If both editors are dirty and the first editor is active, then undo causes the *second* editor to undo.

Basically, the behaviour is exactly what you’d expect if the editor on construction set up an undo handler and registered it in a way that overwrote/supplanted the handler for the previous editor, rather than registering an additional handler and making it active (or not) depending on the editor class instance, rather than the editor class.

We are using our own subclass of ExtensionBasedTextEditor - I know you’re supposed to use extension points and configuration to customise it rather than subclassing, but the subclass is trivial and only overrides initialiseKeyBindingScopes(). This is to set up our own context so that we can have key bindings scoped to the editor type - there are some unfortunate clashes in default eclipse and this is the easiest way to override them.

So that could be a smoking gun, except that we were using an editor subclass quite happily before, and before we switched to tm4e it was doing way more stuff. If I sacrifice the key binding stuff and just wire in the generic editor directly instead of this nearly-trivial subclass it all works quite happily.

Can anyone shed any light on how the command/handler framework routes commands so that it figures out whether a handler should be active based on the active editor? It’s a bit hairy to debug… It’s almost as if there’s some logic that goes

If (this is the generic editor or the generic editor context) {
  dispatch_based_on_individual_editor_instance();
} else {
 dispatch_based_on_type_alone();
}

Almost as if there were some logic that was looking for a very specific class name/editor id and taking the wrong branch because it didn’t recognise the subtype. But again - can’t understand how this wouldn’t have been an issue before.

Many thanks,

Ahmed


Back to the top