-
Notifications
You must be signed in to change notification settings - Fork 12
Remember files opened as Parametric Rascal LSP
before language registration
#809
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
base: main
Are you sure you want to change the base?
Conversation
Keep track of files that are classified as 'Parametric Rascal MPL' language, but with an unknown extension. Once someone registers this extension, store the file state and update the editor as if they were opened *after* registering the language.
'Parametric Rascal MPL
before language registrationParametric Rascal MPL
before language registration
Parametric Rascal MPL
before language registrationParametric Rascal LSP
before language registration
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/ParametricTextDocumentService.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR is a bit involved, as in it requires many places to take into account possible race between registry & availability of the language. Especially if someone later adds a new capability, it'll soon be forgotten.
I'm thinking there might be a way to make a subclass of our ParsingOnlyContribution (like EmptyContribution
) and then connect that to the incoming file. and when a registry comes in, we update all the existing mappings to the new contribution?
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/ParametricTextDocumentService.java
Outdated
Show resolved
Hide resolved
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/ParametricTextDocumentService.java
Outdated
Show resolved
Hide resolved
5c9467d
to
1a0da53
Compare
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/TextDocumentState.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how small this got in the end.
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/ParametricTextDocumentService.java
Outdated
Show resolved
Hide resolved
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/ParametricTextDocumentService.java
Outdated
Show resolved
Hide resolved
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/ParametricTextDocumentService.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't feel complete to me, or else I'm missing some connections.
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/NoContributions.java
Show resolved
Hide resolved
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/NoContributions.java
Outdated
Show resolved
Hide resolved
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/NoContributions.java
Outdated
Show resolved
Hide resolved
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/NoContributions.java
Show resolved
Hide resolved
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/ParametricTextDocumentService.java
Outdated
Show resolved
Hide resolved
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/ParametricTextDocumentService.java
Outdated
Show resolved
Hide resolved
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/ParametricTextDocumentService.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is much better, I have some small questions and stuff we need to improve.
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/NoContributions.java
Outdated
Show resolved
Hide resolved
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/NoContributions.java
Outdated
Show resolved
Hide resolved
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/NoContributions.java
Show resolved
Hide resolved
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/ParametricTextDocumentService.java
Outdated
Show resolved
Hide resolved
rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/ParametricTextDocumentService.java
Outdated
Show resolved
Hide resolved
This reverts commit 27a6410.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two small questions, for the rest it looks find
); | ||
var loc = Locations.toLoc(doc); | ||
return files.computeIfAbsent(loc, | ||
l -> new TextDocumentState(contributions(loc)::parsing, l, doc.getVersion(), doc.getText(), timestamp)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l
and loc
are the same, no need to capture them from outside the closure.
(I don't see why we need this change?)
diagnosticsAsync.complete(diagnostics); | ||
}); | ||
} catch (NoContributionException e) { | ||
logger.debug("Ignoring missing parser for {}", location, e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it no problem that treeAsync is never completed?
This PR keeps track of files that are open with language
Parametric Rascal LSP
, for which there is no language registered yet. Once the user registers a language, we update the associated open editors.This PR closes #795.