Skip to content

Commit 9fdf47b

Browse files
authored
Merge pull request #1017 from usethesource/fix/register-precompiled-parser-crash
Always return a value from (unprovided) contributions
2 parents 78c30e5 + 6e3fdd0 commit 9fdf47b

8 files changed

Lines changed: 243 additions & 216 deletions

File tree

rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/ILanguageContributions.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,22 @@ public interface ILanguageContributions {
7272
public CompletableFuture<IList> parseCodeActions(String command);
7373
public CompletableFuture<IConstructor> parseCallHierarchyData(String data);
7474

75-
public CompletableFuture<Boolean> hasAnalysis();
76-
public CompletableFuture<Boolean> hasBuild();
77-
public CompletableFuture<Boolean> hasDocumentSymbol();
78-
public CompletableFuture<Boolean> hasCodeLens();
79-
public CompletableFuture<Boolean> hasInlayHint();
80-
public CompletableFuture<Boolean> hasRename();
81-
public CompletableFuture<Boolean> hasExecution();
82-
public CompletableFuture<Boolean> hasHover();
83-
public CompletableFuture<Boolean> hasDefinition();
84-
public CompletableFuture<Boolean> hasReferences();
85-
public CompletableFuture<Boolean> hasImplementation();
86-
public CompletableFuture<Boolean> hasCodeAction();
87-
public CompletableFuture<Boolean> hasDidRenameFiles();
88-
public CompletableFuture<Boolean> hasSelectionRange();
89-
public CompletableFuture<Boolean> hasCallHierarchy();
90-
public CompletableFuture<Boolean> hasCompletion();
75+
public CompletableFuture<Boolean> providesAnalysis();
76+
public CompletableFuture<Boolean> providesBuild();
77+
public CompletableFuture<Boolean> providesDocumentSymbol();
78+
public CompletableFuture<Boolean> providesCodeLens();
79+
public CompletableFuture<Boolean> providesInlayHint();
80+
public CompletableFuture<Boolean> providesRename();
81+
public CompletableFuture<Boolean> providesExecution();
82+
public CompletableFuture<Boolean> providesHover();
83+
public CompletableFuture<Boolean> providesDefinition();
84+
public CompletableFuture<Boolean> providesReferences();
85+
public CompletableFuture<Boolean> providesImplementation();
86+
public CompletableFuture<Boolean> providesCodeAction();
87+
public CompletableFuture<Boolean> providesDidRenameFiles();
88+
public CompletableFuture<Boolean> providesSelectionRange();
89+
public CompletableFuture<Boolean> providesCallHierarchy();
90+
public CompletableFuture<Boolean> providesCompletion();
9191

9292
public CompletableFuture<Boolean> specialCaseHighlighting();
9393

rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/InterpretedLanguageContributions.java

Lines changed: 65 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -103,22 +103,22 @@ public class InterpretedLanguageContributions implements ILanguageContributions
103103
private final CompletableFuture<@Nullable IFunction> completion;
104104
private final CompletableFuture<IList> completionTriggerCharacters;
105105

106-
private final CompletableFuture<Boolean> hasAnalysis;
107-
private final CompletableFuture<Boolean> hasBuild;
108-
private final CompletableFuture<Boolean> hasDocumentSymbol;
109-
private final CompletableFuture<Boolean> hasCodeLens;
110-
private final CompletableFuture<Boolean> hasInlayHint;
111-
private final CompletableFuture<Boolean> hasExecution;
112-
private final CompletableFuture<Boolean> hasHover;
113-
private final CompletableFuture<Boolean> hasDefinition;
114-
private final CompletableFuture<Boolean> hasReferences;
115-
private final CompletableFuture<Boolean> hasImplementation;
116-
private final CompletableFuture<Boolean> hasCodeAction;
117-
private final CompletableFuture<Boolean> hasRename;
118-
private final CompletableFuture<Boolean> hasDidRenameFiles;
119-
private final CompletableFuture<Boolean> hasSelectionRange;
120-
private final CompletableFuture<Boolean> hasCallHierarchy;
121-
private final CompletableFuture<Boolean> hasCompletion;
106+
private final CompletableFuture<Boolean> providesAnalysis;
107+
private final CompletableFuture<Boolean> providesBuild;
108+
private final CompletableFuture<Boolean> providesDocumentSymbol;
109+
private final CompletableFuture<Boolean> providesCodeLens;
110+
private final CompletableFuture<Boolean> providesInlayHint;
111+
private final CompletableFuture<Boolean> providesExecution;
112+
private final CompletableFuture<Boolean> providesHover;
113+
private final CompletableFuture<Boolean> providesDefinition;
114+
private final CompletableFuture<Boolean> providesReferences;
115+
private final CompletableFuture<Boolean> providesImplementation;
116+
private final CompletableFuture<Boolean> providesCodeAction;
117+
private final CompletableFuture<Boolean> providesRename;
118+
private final CompletableFuture<Boolean> providesDidRenameFiles;
119+
private final CompletableFuture<Boolean> providesSelectionRange;
120+
private final CompletableFuture<Boolean> providesCallHierarchy;
121+
private final CompletableFuture<Boolean> providesCompletion;
122122

123123
private final CompletableFuture<Boolean> specialCaseHighlighting;
124124

@@ -171,22 +171,22 @@ public InterpretedLanguageContributions(LanguageParameter lang, IBaseTextDocumen
171171
this.completionTriggerCharacters = getContributionParameter(contributions, LanguageContributions.COMPLETION, LanguageContributions.COMPLETION_TRIGGER_CHARACTERS, VF.list(), IList.class);
172172

173173
// assign boolean properties once instead of wasting futures all the time
174-
this.hasAnalysis = nonNull(this.analysis);
175-
this.hasBuild = nonNull(this.build);
176-
this.hasDocumentSymbol = nonNull(this.documentSymbol);
177-
this.hasCodeLens = nonNull(this.codeLens);
178-
this.hasInlayHint = nonNull(this.inlayHint);
179-
this.hasExecution = nonNull(this.execution);
180-
this.hasHover = nonNull(this.hover);
181-
this.hasDefinition = nonNull(this.definition);
182-
this.hasReferences = nonNull(this.references);
183-
this.hasImplementation = nonNull(this.implementation);
184-
this.hasCodeAction = nonNull(this.codeAction);
185-
this.hasRename = nonNull(this.rename);
186-
this.hasDidRenameFiles = nonNull(this.didRenameFiles);
187-
this.hasSelectionRange = nonNull(this.selectionRange);
188-
this.hasCallHierarchy = nonNull(this.prepareCallHierarchy);
189-
this.hasCompletion = nonNull(this.completion);
174+
this.providesAnalysis = nonNull(this.analysis);
175+
this.providesBuild = nonNull(this.build);
176+
this.providesDocumentSymbol = nonNull(this.documentSymbol);
177+
this.providesCodeLens = nonNull(this.codeLens);
178+
this.providesInlayHint = nonNull(this.inlayHint);
179+
this.providesExecution = nonNull(this.execution);
180+
this.providesHover = nonNull(this.hover);
181+
this.providesDefinition = nonNull(this.definition);
182+
this.providesReferences = nonNull(this.references);
183+
this.providesImplementation = nonNull(this.implementation);
184+
this.providesCodeAction = nonNull(this.codeAction);
185+
this.providesRename = nonNull(this.rename);
186+
this.providesDidRenameFiles = nonNull(this.didRenameFiles);
187+
this.providesSelectionRange = nonNull(this.selectionRange);
188+
this.providesCallHierarchy = nonNull(this.prepareCallHierarchy);
189+
this.providesCompletion = nonNull(this.completion);
190190

191191
this.specialCaseHighlighting = getContributionParameter(contributions,
192192
LanguageContributions.PARSING,
@@ -342,7 +342,6 @@ private CompletableFuture<IConstructor> parseCommand(String command) {
342342
return contrib;
343343
}
344344
}
345-
logger.debug("No {} defined", cons);
346345
return null;
347346
});
348347
}
@@ -420,7 +419,7 @@ public InterruptibleFuture<ISourceLocation> prepareRename(IList focus) {
420419
@Override
421420
public InterruptibleFuture<ITuple> rename(IList focus, String newName) {
422421
debug(LanguageContributions.RENAME_SERVICE, newName, focus.isEmpty() ? "" : focus.get(0));
423-
return execFunction(LanguageContributions.RENAME_SERVICE, rename, VF.tuple(VF.list(), VF.list()), focus, VF.string(newName));
422+
return execFunction(LanguageContributions.RENAME_SERVICE, rename, VF.tuple(VF.list(), VF.set()), focus, VF.string(newName));
424423
}
425424

426425
@Override
@@ -496,82 +495,82 @@ private void debug(String name, Object param1, Object param2) {
496495
}
497496

498497
@Override
499-
public CompletableFuture<Boolean> hasDefinition() {
500-
return hasDefinition;
498+
public CompletableFuture<Boolean> providesDefinition() {
499+
return providesDefinition;
501500
}
502501

503502
@Override
504-
public CompletableFuture<Boolean> hasReferences() {
505-
return hasReferences;
503+
public CompletableFuture<Boolean> providesReferences() {
504+
return providesReferences;
506505
}
507506

508507
@Override
509-
public CompletableFuture<Boolean> hasImplementation() {
510-
return hasImplementation;
508+
public CompletableFuture<Boolean> providesImplementation() {
509+
return providesImplementation;
511510
}
512511

513512
@Override
514-
public CompletableFuture<Boolean> hasHover() {
515-
return hasHover;
513+
public CompletableFuture<Boolean> providesHover() {
514+
return providesHover;
516515
}
517516

518517
@Override
519-
public CompletableFuture<Boolean> hasExecution() {
520-
return hasExecution;
518+
public CompletableFuture<Boolean> providesExecution() {
519+
return providesExecution;
521520
}
522521

523522
@Override
524-
public CompletableFuture<Boolean> hasInlayHint() {
525-
return hasInlayHint;
523+
public CompletableFuture<Boolean> providesInlayHint() {
524+
return providesInlayHint;
526525
}
527526

528527
@Override
529-
public CompletableFuture<Boolean> hasRename() {
530-
return hasRename;
528+
public CompletableFuture<Boolean> providesRename() {
529+
return providesRename;
531530
}
532531

533532
@Override
534-
public CompletableFuture<Boolean> hasDidRenameFiles() {
535-
return hasDidRenameFiles;
533+
public CompletableFuture<Boolean> providesDidRenameFiles() {
534+
return providesDidRenameFiles;
536535
}
537536

538537
@Override
539-
public CompletableFuture<Boolean> hasCodeLens() {
540-
return hasCodeLens;
538+
public CompletableFuture<Boolean> providesCodeLens() {
539+
return providesCodeLens;
541540
}
542541

543542
@Override
544-
public CompletableFuture<Boolean> hasDocumentSymbol() {
545-
return hasDocumentSymbol;
543+
public CompletableFuture<Boolean> providesDocumentSymbol() {
544+
return providesDocumentSymbol;
546545
}
547546

548547
@Override
549-
public CompletableFuture<Boolean> hasCodeAction() {
550-
return hasCodeAction;
548+
public CompletableFuture<Boolean> providesCodeAction() {
549+
return providesCodeAction;
551550
}
552551

553552
@Override
554-
public CompletableFuture<Boolean> hasSelectionRange() {
555-
return hasSelectionRange;
553+
public CompletableFuture<Boolean> providesSelectionRange() {
554+
return providesSelectionRange;
556555
}
557556

558-
public CompletableFuture<Boolean> hasCallHierarchy() {
559-
return hasCallHierarchy;
557+
public CompletableFuture<Boolean> providesCallHierarchy() {
558+
return providesCallHierarchy;
560559
}
561560

562561
@Override
563-
public CompletableFuture<Boolean> hasCompletion() {
564-
return hasCompletion;
562+
public CompletableFuture<Boolean> providesCompletion() {
563+
return providesCompletion;
565564
}
566565

567566
@Override
568-
public CompletableFuture<Boolean> hasAnalysis() {
569-
return hasAnalysis;
567+
public CompletableFuture<Boolean> providesAnalysis() {
568+
return providesAnalysis;
570569
}
571570

572571
@Override
573-
public CompletableFuture<Boolean> hasBuild() {
574-
return hasBuild;
572+
public CompletableFuture<Boolean> providesBuild() {
573+
return providesBuild;
575574
}
576575

577576
@Override

0 commit comments

Comments
 (0)