Skip to content

[POM-leading for DSLs] Dynamic capabilities#1117

Open
toinehartman wants to merge 43 commits into
feature/1010-pom-leading-for-dsls/finalfrom
feature/1010-pom-leading-for-dsls/1079-dynamic-capabilities
Open

[POM-leading for DSLs] Dynamic capabilities#1117
toinehartman wants to merge 43 commits into
feature/1010-pom-leading-for-dsls/finalfrom
feature/1010-pom-leading-for-dsls/1079-dynamic-capabilities

Conversation

@toinehartman

@toinehartman toinehartman commented Jun 15, 2026

Copy link
Copy Markdown
Member

Implement dynamic capabilities for POM-leading servers.

Closes #1079.

@toinehartman toinehartman self-assigned this Jun 15, 2026
@toinehartman toinehartman added the enhancement New feature or request label Jun 15, 2026
@toinehartman toinehartman force-pushed the feature/1010-pom-leading-for-dsls/1079-dynamic-capabilities branch 2 times, most recently from 222849f to 43787d2 Compare June 17, 2026 08:41
DavyLandman added a commit that referenced this pull request Jun 22, 2026
1. Set document selectors for capabilities, such that capabilities can
only be triggered on documents that support them. Especially useful when
registering multiple languages.
2. Dynamically register semantic highlighting capability (to test the
former change, and make a start with registering all capabilities
dynamically).
3. Instead of toggling the language for open editors, request a refresh
of the open editors via LSP. This prevents races where requests can come
in while the file is 'closed'.

This PR is a preparation to easily enable #1117.
@toinehartman toinehartman force-pushed the feature/1010-pom-leading-for-dsls/final branch from 2fdc776 to 45b8638 Compare June 25, 2026 06:57
@toinehartman toinehartman force-pushed the feature/1010-pom-leading-for-dsls/1079-dynamic-capabilities branch 8 times, most recently from f001c98 to 52aeaaa Compare June 30, 2026 13:16
@toinehartman toinehartman force-pushed the feature/1010-pom-leading-for-dsls/1079-dynamic-capabilities branch from 52aeaaa to 76aeb65 Compare June 30, 2026 14:43
@toinehartman toinehartman force-pushed the feature/1010-pom-leading-for-dsls/1079-dynamic-capabilities branch from 76aeb65 to 62ffc76 Compare June 30, 2026 15:22
@toinehartman toinehartman marked this pull request as ready for review July 2, 2026 12:09

@DavyLandman DavyLandman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice! Just some small points.

public class CompletableFutureUtils {
private CompletableFutureUtils() {/* hidden */ }

public static final CompletableFuture<Void> NOOP = CompletableFuture.completedFuture(null);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while this is nice, it has no exec bound to it? isn't that a problem?


private CompletableFuture<Void> registerCapability(Registration r) {
var c = currentRegistrations.computeIfAbsent(r.getMethod(), k -> new CopyOnWriteArraySet<>());
// Lock on the registrations for this method for a moment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we explain why we lock? who else might be doing this registration?

and why we lock for so long?

My concern is that the exceptionally handler that manipulates c is executed outside the lock (and not relocking).

return client.unregisterCapability(new UnregistrationParams(List.of(u)))
.exceptionally(t -> {
logger.error("Exception while unregistering {} ({})", u.getMethod(), u, t);
c.addAll(cs);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, no lock here, is that fine? and if so, let's explain why.

Comment thread rascal-vscode-extension/src/test/vscode-suite/dsl-mix.test.ts
@sonarqubecloud

sonarqubecloud Bot commented Jul 3, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants