Tags: tricktron/frege-lsp-server
Tags
Refactor & Fixes (#45) * fix: shutdown threadpool executor on language server shutdown * refactor: create new lsp package and move classes * refactor: manage compiler global state in compileService class instead of in fregeTextDocumentService class * refactor: extract createLanguageServerOutputDir to its own function * refactor: extract project setup logic to new projectService class from FregeLanguageServer class
Gradle Tooling Api Support (#39) * feat: read frege main source dir and dependencies from build.gradle if available This integrates the frege-gradle-plugin with the frege-lsp server! * refactor: use factory method to read project options * chore: bump version * fix: include name change from gradle plugin * fix: include package name change from gradle plugin * chore: update gradle plugin 4.1.0 -> 4.2.0
Make Mode Support (#37) * WIP: make mode exploration The make mode seems to work correctly. However I am unable to extract the global of the compiled module yet. In addition, I cannot yet handle the asynchronous nature in a test case. * refactor: move all make mode explorations into its own module Add one new test and ensure that all tests pass. * feat: make mode now finally works * refactor: adapt make mode to architecture The lsp4j `FregeTextDocumentService` class should only call into the service layer and not directly into Frege core classes like `CompileMakeMode`. As a result, I added a `CompileService` class which takes care of the compilation. The compilation's call flow is now equal to the ones of the language features: FregeTextDocumentService -> (Compile)Service -> (CompileExecutor)LSP -> CompileMake (Frege core class). Additional things done: - various cleanup - various unifications * fix: create compile output dir on initialize The output directory must exist so that the class loader can correctly resolve dependencies and imports on the classpath. * feat!: change to incremental document sync Breaking change: make mode needs to read from disk to resolve dependencies and recognise the project structure. As a result, I switched the single source of truth of the document state to disk altogether whereas before it was in the client's buffer. This results in the following lifecycle change: Instead of getting the document content through the didChange notification (ownership in the client's buffer), I read the content in the didSave notification from disk. As a consequence, frege files are only compiled when saved and language features may show outdated info until the files are saved. However, this can easily be automated using autosave in the client. * fix: change hardcoded local paths to relative to make tests pass
feat: compile frege files (#35) Local frege imports are resolved with .class files on the classpath. For this we need to compile the frege files to java first and then run the java compiler to compile to .class files. However, since make mode is not yet completely implemented, the imports are not resolved interactively. As a result, you may have to restart the language server completely if you change the dependency of a module.
Split Compile from Language Feature (#33) * WIP: how to make the frege compiler configurable explore the effort of reading a gradle plugin property with the gradle tooling api. * feat: add shouldCorrectlyConfigureExtraClasspath test Expose two environment variables to configure the frege compiler: - FREGE_LSP_SOURCE_DIR - FREGE_LSP_EXTRA_CLASSPATH * refactor: split compilerHelper into compileOptions, compileGlobal and compileExecutor modules * refactor: WIP: separate compile from language feature code changes should drive the compilation. Therefore, compile the code in the didSave, didChange events and update the global. The language features the just get the information from the global. This does currently not work because I wrongly used an IO Global as state. Instead it should be a Global only that we can get with performUnsafe. Otherwise we stay in IO and due to the laziness no work, that means no compilation is done. Search for the marked TODO in the code to see where to make the changes. Rebase on main first! * refactor: use Global instead of IO Global as state Resolves all the todos introduced by the previous commit. * chore: update version
Hover Support (#25) * WIP: explore contentProposal function * feat: get type from resolved tokens * feat: make the first test pass * feat: make it work end to end * feat: add markdown fenced code block support * refactor: clean up unused functions and imports * fix: run tests before `installDist` task to catch failures early * refactor: new package layout - types: contains common types - lsp4j: contains the lsp4j bindings The new structure isolates the two language features diagnostics and hover from each other. In other words, the core class diagnostic.Diagnositc should never import hover.Hover and vice versa. * fix: move `index - 1` logic to `PositionLSP4J.fr` * refactor: extract `tokenToRange` to `Range.fr` and reuse it in `Diagnostic.fr` * chore: update frege gradle plugin 2.0.1 -> 4.0.1 This allows to test multiple modules with the `testFrege` command. * refactor: rename LSPDiagnostic -> DiagnosticLSP and FregeDiagnosticService -> DiagnosticService * feat: map compiler hints -> `DiagnosticSeverity.Information` instead of `DIagnosticSeverity.Hint` See #22. * chore: update frege-gradle-plugin to 4.1.0-alpha As a result, the installDist task compiles all frege modules and tests the specified frege modules before installing it. * fix: update workflow to latest gradle plugin v4.1.0-alpha * chore: update gradle wrapper 7.1 -> 7.4.2
Directly Integrate the Frege Compiler for Diagnostics (#21) * feat: extract compiler messages directly from global and map to new lsp Diagnostic type * refactor: use StG instead of passing around global * feat: add test for mapping multiple compiler messages to diagnostics * feat: add multiple tokens test and make it pass * refactor: Separate compile code from diagnostic code into its own modules * refactor: `getDiagnostics :: String -> IO [ Diagnostics]` instead of `String --> StIO [ Diagnostics ]` * feat: use java native declarations to map `Diagnostic` to `DiagnosticLSP` * fix: column index start = 0 instead of 1 Besides, this also adds the code to test it end to end. * refactor: simplify project structure The idea of the new structure follows the new vision of writing most of the code in frege. As a first result, we get the following layered call structure: `FregeDiagnosticService` (Java) -> `DiagnosticLSP` (lsp interface in Frege) -> `Diagnostic` (core code interacting with the Frege compiler). Despite the clear separation by layer, the packages are organised by (language features). E.g, diagnostic, hover etc to keep the components isolated. * chore: simplify github workflow after refactoring * fix: v2.0.2-alpha tag does not exist yet. Go back to v2.0.1-alpha. * refactor: pattern match on records
Improves Compiler Error Matching (#15) * fix: improves compiler error matching - In some cases the range (line, col) for the compiler errors were not matching the range (line, col) of the source code. - adds the `make` flag for the compiler so that it resolves local imported modules. * chore: upgrades workflow to frege gradle plugin v.2.0.1-alpha * chore: updates jacoco code coverage badges Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
PreviousNext