I am trying out figure out Rascal LSP and I have it working fine but I want to enable the TypeChecker but I can’t figure out how to construct a Builder object to pass to builder function from the code below?
@synopsis{Each kind of service contributes the implementation of one (or several) IDE features.}
data LanguageService
= parser(Parser parser)
| summarizer(Summarizer summarizer
, bool providesDocumentation = true
, bool providesDefinitions = true
, bool providesReferences = true
, bool providesImplementations = true)
| outliner(Outliner outliner)
| completer(Completer completer)
| builder(Builder builder)
| lenses(LensDetector detector)
| inlayHinter(InlayHinter hinter)
| executor(CommandExecutor executor)
| documenter(Documenter documenter)
| definer(Definer definer)
| referrer(Referrer reference)
| implementer(Implementer implementer)
;
set[LanguageService] aliasesContributions() = {
parser(parser(#start[Program]))
build(“alias", checkAliases)// How do I construct this?
outliner(aliasesOutliner),
summarizer(aliasesSummarizer, providesImplementations = false)
};
Tree checkAliases(Tree input){
model = aliasesTModelFromTree(input); // your function that collects & solves
types = getFacts(model);
return input[@messages={*getMessages(model)}]
[@hyperlinks=getUseDef(model)]
[@docs=(l:"<prettyAType(types[l])>" | l <- types)];
}
I have gone through all the examples I can find but I haven't seen one that has it
These two code files contains examples: https://github.com/usethesource/rascal-language-servers/blob/main/examples/pico-dsl-lsp/src/main/rascal/lang/pico/LanguageServer.rsc and https://github.com/usethesource/rascal-language-servers/blob/main/rascal-lsp/src/main/rascal/demo/lang/pico/LanguageServer.rsc
Roughly, if you register a
summarizeryou get called on ever save, than you have the option of typechecking it. I just checked the code, thebuilderis currently not hooked-up yet. But the code you have for thecheckAliasescan be rewrittten to return theSummaryadt.