tricktron / frege-lsp-server

Frege Language Server Using the Language Server Protocol
MIT License
1 stars 0 forks source link

Think about Splitting Compile From Language Feature Step #27

Closed tricktron closed 2 years ago

tricktron commented 2 years ago

Most Language Features need information from a correctly compiled file. As a result, I designed the two language features to always compile the file first: e.g DiagnosticLSP.compileAndGetDiagnosticsLSP.

This leads to the following dependency chain: languageFeatureService->languageFeatureLSP->languageFeature->compilerHelper.

Consider splitting this again in two steps: First compile and then do language feature work. This leads to the following two dependency chain: languageFeatureService -> compilerHelper languageFeatureService -> languageFeatureLSP -> languageFeature

Right now, I don't know which way is better to go forward. I keep this issue to remind me again to consider this architectural change/possibility when it might be needed.

Remember: Combining is always easier than splitting.

Edit: After some thinking: Who should decide when to compile? Right now the language feature decides which doesn't make any sense: E.g every hover leads to a compile call, which does not hurt because the frege compiler has a good caching implemented.

Compilation should be driven by code changes. That means that the change event should call the frege compiler and the language feature only gets what it needs from the global.