Ultra-lightweight VSCode extension + Language Server Protocol (LSP) lightweight server for Kotlin, Java, C and C++ files.
Supported features
- Kotlin (
.kt,.kts), Java (.java), C (.c,.h), and C++ (.cpp,.cc,.cxx,.hpp,.hh,.hxx) documents - Kotlin syntax highlighting (TextMate grammar)
- Document Symbol (
@in VSCode quick open): lists symbols for current file - Breadcrumb symbol path: shows the current Kotlin / Java / C type and function or method in the editor path bar when Breadcrumbs are enabled
- Go to Definition (
F12/ cmd-click): resolves symbols from open documents, then falls back to full-project scan, and finally to bundled Kotlin / Java / JVM API stubs. By default,F12and Ctrl/Cmd-click open documentation fallback when no definition target is found; this can be disabled withkotlinJavaCLanguageServer.definitionFallback.enabled - Bundled API stubs: F12 on Kotlin stdlib helpers (
isNotBlank,firstOrNull,let,apply, etc.), common Java APIs, and importedjavax.inject/jakarta.injecttypes opens bundled reference stubs with signatures and short docs - Workspace Symbol (
#in quick open): searches open documents first, then falls back to full-project scan when no match is found - Quick Symbol Search in Project (editor right-click menu): searches the workspace from the word under cursor and provides jump targets
- Quick Reference Search in Project (
Cmd+Alt+R/Ctrl+Alt+R, or editor right-click menu): finds every usage of the symbol under the cursor across the workspace. Behaves like Goto Definition — a single match jumps directly, multiple matches open VS Code's inline Peek view - Explain Unknown Symbol (editor right-click menu / Command Palette): when the symbol under the cursor has no local/project/bundled-stub definition target, opens an in-editor documentation result page with official Kotlin / Java / Android / C / C++ summaries, declarations, details, and reference links where available
- Android ViewBinding mapping:
ActivityDeviceInfoBindingautomatically maps tores/layout*/activity_device_info.xmlfor direct jump
Current scope intentionally focuses on symbols that are already opened in VSCode.
Architecture
src/extension.ts: VSCode Language Clientsrc/server.ts: Node-based LSP serversrc/symbols.ts: Kotlin / Java / C symbol parsing and cursor word extraction
This follows the standard VSCode Language Client + Language Server split architecture.
Install dependencies
npm install
Build
npm run compile
Run in VSCode (manual review)
- Open this repository in VSCode.
- Run
npm run compile. - Press
F5to launch an Extension Development Host. - In the new window, open a Kotlin, Java, or C file.
- Verify:
Cmd+Shift+O(or quick open with@) shows symbols from current file.- Breadcrumbs show the current symbol path for Kotlin, Java, and C files when
breadcrumbs.enabledis on. F12on a symbol jumps to its definition when the defining file is currently open.
Package and install in local VSCode
- Install VSCE:
npm install -D @vscode/vsce - Create VSIX:
npx vsce package --allow-missing-repository - Install VSIX:
code --install-extension kotlin-java-language-server-0.2.2.vsix
Release Notes
0.2.2
- Imported JVM API stubs: Added bundled
javax.injectandjakarta.injectstubs (Inject,Named,Provider,Qualifier,Scope,Singleton) so Kotlin/Java imports can jump directly with F12. - Imported API documentation queries: Imported non-Android symbols now fall back to package-aware documentation entry points and fully-qualified search queries instead of per-symbol hardcoded API pages.
- Kotlinx Coroutines documentation summaries: Imported
kotlinx.coroutinessymbols such aslaunchnow open the official Kotlin API reference and show extracted signatures and summaries in-editor. - Android package summaries: Android / AndroidX API fallback pages now combine class references with package-summary entries, so symbols such as
androidx.fragment.app.Fragmentshow useful package API summaries in-editor instead of only generic reference links. - Fragment ViewBinding field navigation: Kotlin Fragment patterns such as
_binding: FragmentHomeBinding?plusbinding get() = _binding!!now resolvebinding.someViewIdto the matchingres/layout*/fragment_*.xmlID, including camelCase Android IDs such ashomeToolbar. - Java Android fallback preservation: Java files with Android imports keep their direct Android Kotlin/Java reference links instead of being overwritten by the generic Android search fallback.
0.2.1
- Explain Unknown Symbol direct lookup: Manually running Explain Unknown Symbol now always opens the official documentation result page for the selected symbol, even when the symbol already has a local definition. F12 / Ctrl-click fallback still only opens documentation when definition lookup returns no target.
0.2.0
- Explain Unknown Symbol: New editor context menu / Command Palette command. It first asks the existing definition provider; only if no local, project, XML/ViewBinding, or bundled-stub target exists does it open an in-editor result page with official Kotlin / Java / Android / C / C++ documentation summaries, declarations, details, and links where available.
- Definition fallback to documentation: Added
kotlinJavaCLanguageServer.definitionFallback.enabledsetting. It defaults totrue, soF12and Ctrl/Cmd-click open the in-editor external documentation result page when definition lookup returns no target. Disable it to keep VS Code's built-in definition behavior only. The fallback command is not shown in the editor context menu to avoid duplicating the built-in Go to Definition item. - Multi-language builtin stubs: The bundled fallback now covers Kotlin, Java, C, and C++ standard-library symbols instead of Kotlin-only stubs. C++ also checks C stubs for common C library functions available from C++ code.
- Kotlin stdlib coverage expansion: Added common missing symbols such as
runCatching,Result.getOrThrow,getOrNull,onSuccess,onFailure,mapCatching,recover, sequence builders, array factories, map/set factories, anduse. - Java / C / C++ standard library references: Added lightweight local reference stub files for high-frequency Java APIs (
String,System,Math,Arrays,Collections,Optional), C APIs (printf,malloc,strlen,memcpy,isdigit,sqrt, etc.), and C++ APIs (std::string,vector,map,optional,sort,find,accumulate, smart pointer helpers, etc.). - Stub parser regression test: Added test coverage to verify representative bundled standard-library symbols remain navigable.
0.1.18
- Goto Definition relevance ranking: When
F12finds multiple symbols with the same name, results are now sorted so the most likely definition appears first. Same-file matches win, with closer-to-cursor and at-or-before-cursor preferred; across files, those sharing more directory segments with the current file rank higher. Pure path comparison — no extra IO and the cost is negligible (microseconds for the small candidate set). - Returns full ranked list: Indexed open-file matches now return all candidates sorted by relevance (rather than just the single best), so VS Code's Peek view shows the same order as Quick Reference Search. Project-scan fallbacks also share the same ranking.
0.1.17
- Quick Reference Search in Project: New command
kotlinJavaCLanguageServer.quickReferenceSearchfinds every usage of the symbol under the cursor across the workspace. Triggered via right-click menu, Command Palette, or the default keybindingCmd+Alt+R(macOS) /Ctrl+Alt+R(Windows/Linux). - Goto Definition–style UI: A single match jumps directly to the location; multiple matches open VS Code's native inline Peek view, identical to
F12/ Peek Definition / Find All References. - Comment / string aware scanning: Reference matches use whole-word boundaries and skip occurrences inside
// line comments,/* block comments */,"strings",'chars', and Kotlin triple-quoted ("""…""") blocks. - LSP
referencesProvider: The server now implementstextDocument/references, so other clients (and VS Code's own "Find All References" / Peek View) also work for Kotlin, Java, C, and C++ files.
0.1.16
- C++ support: Added full C++ (
.cpp,.cc,.cxx,.hpp,.hh,.hxx) language support —@document symbols,F12Go to Definition, Breadcrumbs, and workspace symbol search now work for C++ files. - C++ symbols: class, struct, namespace, enum class (with members), template class/function, operator overloads, destructor,
usingtype alias, out-of-line method definitions (Foo::bar()), local variables and function parameters.
0.1.15
- Critical fix: extension now activates when opening Kotlin / Java / C files — Added
onLanguage:kotlin,onLanguage:java,onLanguage:ctoactivationEvents, and packagednode_modulesinto VSIX. Previously the LSP server never started, causing blank@symbols, brokenF12, and missing Breadcrumbs. - F12 on function parameters — Pressing F12 on parameters like
intensityLevelororiginalColorValuenow correctly jumps to their declaration in the function signature. - F12 on local
val/var— Pressing F12 on local variables likehatXnow correctly jumps to their declaration. - Scope-aware Go to Definition: When multiple symbols share the same name, the definition closest to (and before) the cursor in the same file is preferred over definitions in other files.
0.1.13
- Kotlin stdlib F12 navigation: Press
F12(Go to Definition) on built-in Kotlin extension functions such asisNotBlank,firstOrNull,let,apply,scan,buildList,require,coerceIn,joinToString, etc. to jump to a bundled reference stub file (assets/kotlin-stdlib-stubs.kt) that shows the function signature and a KDoc description. - Stdlib stubs coverage: CharSequence (
isEmpty,isNotEmpty,isBlank,isNotBlank,trim,lines…), nullable String (isNullOrBlank,isNullOrEmpty,orEmpty), String (toInt/OrNull,toLong/OrNull,substringAfter/Before/Last,removePrefix/Suffix,startsWith,endsWith,padStart/End,chunked,trimIndent,ifEmpty,ifBlank,encodeToByteArray,toRegex…), scope functions (let,run,apply,also,with,takeIf,takeUnless), Collection/Iterable (first/OrNull,last/OrNull,single/OrNull,any,all,none,filter,map,mapIndexed,flatMap,fold,reduce,scan,runningFold,groupBy,sortedBy/Descending,distinct/By,take/While,drop/While,zip,zipWithNext,unzip,windowed,associate/With/By,intersect,union,subtract,partition,onEach,joinToString,maxByOrNull,minByOrNull,sumOf,withIndex,ifEmpty…), Map (getOrDefault,getOrPut,mapKeys,mapValues), top-level utilities (buildString,buildList,buildSet,buildMap,lazy,require,requireNotNull,check,checkNotNull,error,TODO,repeat,listOf,setOf,mapOf…), and Range operators (downTo,until,step). - User symbols take priority: The stdlib lookup is step 5 (last resort), so your own functions with the same name always jump to your code first.
0.1.12
- Kotlin enum members with constructor params:
PENDING(0),/ACTIVE(1),and all parameterised enum entries are now correctly indexed asenummembersymbols (was: silently dropped due to a regex anchor bug on the prefix before(). - Kotlin
annotation class: Classes declared withannotation class(e.g. Spring / Jakarta / Android custom annotations) are now indexed. Also enablesfun interfaceSAM declarations. - Kotlin
operator/override/tailrecfunctions: Methods declared withoperator fun,override fun,tailrec fun,external fun,actual fun, orexpect funare now indexed asmethod/functionsymbols. - Kotlin extension functions on generic receivers:
fun List<T>.filterActive(),fun Flow<T>.retry(), and similar extensions on parameterised types are now matched correctly. - Kotlin
for ((key, value) in map)destructuring: Destructured loop variables are now extracted asparametersymbols before the control-flow guard fires. - C pointer-return-type functions: Functions like
Buffer *buffer_create(...),struct Node *node_create(...), andchar *strdup(...)— where there is no space between*and the function name — are now parsed correctly.struct/union/enumreturn-type prefixes are also handled. - C anonymous
typedef struct/typedef enum/typedef union: The closing line} Alias;is now matched by a new typealias rule, soStudent,StatusCode,EventHandlers,PageTableEntry,U32Split, and similar names are indexed. - Java
@interfaceannotation types: Annotation type declarations (e.g.@interface Transactional) are now recognised and listed asprotocolsymbols. - Comprehensive test suite: Added
tmp/test_sample.{kt,java,c}(25 Kotlin / 15 Java / 25 C scenarios) andsrc/test/comprehensive.test.ts(52 tests) covering lambdas, destructuring, macros, typedefs, generics, sealed classes, records, varargs, and more.
0.1.11
- Kotlin & Java lambda parameters: Index lambda parameters (parenthesized and single-param forms) and emit them as
parametersymbols so lambda arguments can be navigated. - Kotlin destructuring: Detect destructuring declarations (
val (a, b) = ...,for ((k, v) in ...)) and function parameter destructuring. - C macros & typedefs: Index
#definemacros asmacrosymbols and correctly recognize function-pointertypedefs (e.g.,typedef void (*cb_t)(int)) astypealias. - Tests & packaging: Added unit tests for sample files and produced the VSIX package
kotlin-java-language-server-0.1.11.vsix.
0.1.10
- C local symbol parsing: C function-local variables are now indexed for navigation, including declarations such as
size_t dlen, clen;andint val; - Improved C F12 support: Go to Definition can now jump to local C variables like
clenandvalinside the current function
0.1.9
- C Breadcrumbs fix: C functions now stay visible in Breadcrumbs when the function signature spans multiple lines or the opening brace appears on a later line
- Improved C function parsing: Multiline C function signatures now produce hierarchical
DocumentSymbolranges that cover the full function body
0.1.8
- Output logging: Added dedicated Output and Trace channels for language-server logs in VS Code
- Error visibility: Startup failures and uncaught server errors are now written to Output and revealed automatically on error
0.1.7
- Breadcrumb symbol path: Kotlin, Java, and C now return hierarchical
DocumentSymboltrees so VS Code Breadcrumbs can show the current type and function or method path - Improved symbol ranges: Type and executable symbol ranges now cover their full scopes, which makes current-scope detection work inside method and function bodies
0.1.5
- Symbol search ranking: Workspace symbol results are now sorted by relevance — exact match → prefix match (CamelCase preferred) → contains match
- ViewBinding in
#search: TypingActivityMainin quick open (#) now resolves to the corresponding XML layout file - Improved ViewBinding conversion: Better handling of edge cases like
HTTPResponseBinding→http_response.xml
0.1.4
- Phase 1: Enhanced symbol parsing — supports inner class, value class, annotation class, sealed permits, static nested class, companion object with name, annotated methods
- Annotation stripping: Robust handling of complex annotations (balanced parentheses)
- Control flow filter fix: No longer filters valid lines containing keywords in method bodies