在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):fwcd/kotlin-language-server开源软件地址(OpenSource Url):https://github.com/fwcd/kotlin-language-server开源编程语言(OpenSource Language):Kotlin 97.5%开源软件介绍(OpenSource Introduction):Kotlin Language ServerA language server that provides smart code completion, diagnostics, hover, document symbols, definition lookup, method signature help and more for Kotlin. Any editor conforming to LSP is supported, including VSCode and Atom. Getting Started
PackagingThis repository needs your help!The original author created this project while he was considering using Kotlin in his work. He ended up deciding not to and is not really using Kotlin these days though this is a pretty fully-functional language server that just needs someone to use it every day for a while and iron out the last few pesky bugs. There are two hard parts of implementing a language server:
The project uses the internal APIs of the Kotlin compiler. Figuring out the dependenciesDependencies are determined by the DefaultClassPathResolver.kt, which invokes Maven or Gradle to get a list of classpath JARs. Alternatively, projects can also 'manually' provide a list of dependencies through a shell script, located either at
#!/bin/bash
echo /my/path/kotlin-compiler-1.4.10/lib/kotlin-stdlib.jar:/my/path/my-lib.jar
@echo off
echo C:\my\path\kotlin-compiler-1.4.10\lib\kotlin-stdlib.jar;C:\my\path\my-lib.jar Incrementally re-compiling as the user typesI get incremental compilation at the file-level by keeping the same Getting incremental compilation at the expression level is a bit more complicated:
The incremental expression compilation logic is all in CompiledFile.kt. The Kotlin AST has a built-in repair API, which seems to be how IntelliJ works, but as far as I can tell this API does not work if the surrounding IntelliJ machinery is not present. Hence I created the "fake tiny file" incremental-compilation mechanism, which seems to be quite fast and predictable. There is an extensive suite of behavioral tests, which are all implemented in terms of the language server protocol, so you should be able to refactor the code any way you like and the tests should still work. Modules
Scripts
Protocol ExtensionsThe Kotlin language server supports some non-standard requests through LSP. See KotlinProtocolExtensions for a description of the interface. The general syntax for these methods is FeaturesAutocompleteSignature helpHoverGo-to-definition, find all referencesDocument symbolsGlobal symbolsAuthors |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论