Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
1b069cb
fix: add ability to re-write class name references in desugar plugin
itsaky-adfa Mar 19, 2026
a70fd66
feat: integrate Kotlin analysis API
itsaky-adfa Mar 19, 2026
4ca1e97
Merge branch 'stage' into fix/ADFA-3366-include-analysis-api-as-depen…
itsaky-adfa Mar 19, 2026
43286a6
fix: update kotlin-android to latest version
itsaky-adfa Mar 23, 2026
f1fe62f
fix: remove UnsafeImpl
itsaky-adfa Mar 25, 2026
6e6d8b3
fix: update kotlin-android to latest version
itsaky-adfa Mar 25, 2026
b208658
fix: replace usages of Unsafe with UnsafeImpl
itsaky-adfa Mar 24, 2026
c844ad2
fix: make Kotlin LSP no-op
itsaky-adfa Mar 23, 2026
58db2cb
feat: configure K2 standalone session when setting up LSP
itsaky-adfa Mar 24, 2026
bf7acd1
fix: JvmTarget resolution fails for input "21"
itsaky-adfa Mar 24, 2026
dc62a51
fix: do not early-init VirtualFileSystem
itsaky-adfa Mar 24, 2026
4b1c8e4
fix: remove replaceClass desugar instruction for Unsafe
itsaky-adfa Mar 25, 2026
b14f6ee
fix: ensure boot class path is added as dependency to Android modules
itsaky-adfa Mar 26, 2026
54ca7a9
feat: add diagnostic provider for Kotlin
itsaky-adfa Mar 26, 2026
6e4d458
fix: remove unnecessary log statement
itsaky-adfa Mar 26, 2026
5d841a3
fix: update to latest kotlin-android release
itsaky-adfa Mar 26, 2026
4b7b0f2
fix: always re-initialize K2 session on setupWithProject
itsaky-adfa Mar 26, 2026
e2f137a
fix: diagnostics are always collected from the on-disk file
itsaky-adfa Mar 26, 2026
09fc9ea
feat: add the ability to incrementally invalidate source roots on pro…
itsaky-adfa Mar 30, 2026
dd3d519
fix: dispatch build-related events from GradleBuildService
itsaky-adfa Mar 31, 2026
d6defa6
feat: introduct KtFileManager
itsaky-adfa Mar 31, 2026
4666893
fix: add initial K2-backed scope code completions
itsaky-adfa Apr 1, 2026
2f982a7
feat: add member completions backed by K2
itsaky-adfa Apr 2, 2026
4129a47
feat: suggest local and imported extension functions
itsaky-adfa Apr 2, 2026
7d736fa
fix: do not suggest extension functions for scope completions
itsaky-adfa Apr 2, 2026
87234f8
feat: add scope-sensitive keyword completions
itsaky-adfa Apr 3, 2026
7d78db1
feat: add indexing api and service implementation
itsaky-adfa Apr 6, 2026
c35aa9f
fix: metadata version is sometimes not parsed
itsaky-adfa Apr 7, 2026
bede4db
fix: make JvmSymbolIndex exclusive to external libraries
itsaky-adfa Apr 8, 2026
9eb4ffe
feat: add module resolver to resolve library modules from source path
itsaky-adfa Apr 8, 2026
1fdd5b3
feat: add support for completing non-imported symbols
itsaky-adfa Apr 8, 2026
c78d5ab
fix: use Kotlin context receivers feature
itsaky-adfa Apr 8, 2026
47d1738
fix: auto-import un-imported classes
itsaky-adfa Apr 9, 2026
eed2d03
fix: use internal name repr for library index
itsaky-adfa Apr 9, 2026
e6fcf6e
fix: filter-out ext syms with inapplicable receivers
itsaky-adfa Apr 9, 2026
9fa3d4a
feat: add Kotlin source file index
itsaky-adfa Apr 9, 2026
ab5c7d9
fix: infinite loop when converting type names to display names
itsaky-adfa Apr 10, 2026
0ec7b4b
fix: update ModuleResolver to resolve KaSourceModule from file path
itsaky-adfa Apr 10, 2026
bf9b2da
fix: update KotlinSourceScanner to use internal names in index
itsaky-adfa Apr 10, 2026
49e7efe
feat: add custom implementations of analysis API services
itsaky-adfa Apr 13, 2026
a33427d
fix: use StandaloneProjectFactory to create MockProject
itsaky-adfa Apr 13, 2026
51d0686
feat: add support for indexing classes using VirtualFile
itsaky-adfa Apr 13, 2026
e77df48
feat: create in-memory KtFile instances for modified files
itsaky-adfa Apr 14, 2026
340b08b
fix: IndexWorker always re-index libraries
itsaky-adfa Apr 14, 2026
a1d999e
feat: add KtFile.backingFilePath for better resolution of declaring m…
itsaky-adfa Apr 14, 2026
49542ad
fix: remove library indexing logic for kt index worker
itsaky-adfa Apr 14, 2026
888193f
feat: add index for generated JARs
itsaky-adfa Apr 14, 2026
f3997a5
fix: java source files are not recognized by analysis API
itsaky-adfa Apr 14, 2026
a0e3075
fix: remove unused kotlin lsp modules
itsaky-adfa Apr 15, 2026
fbab307
fix: add basic test cases for indexing and keyword completions
itsaky-adfa Apr 15, 2026
bcbbba3
chore: trigger ci
itsaky-adfa Apr 15, 2026
ea6c1ca
feat: add snippets for Kotlin sources
itsaky-adfa Apr 16, 2026
f29e83a
feat: make comment/uncomment line actions generic to LSP implementations
itsaky-adfa Apr 16, 2026
9e18834
fix: register comment/uncomment line actions in Kotlin LSP
itsaky-adfa Apr 16, 2026
c569cb6
fix: comment/uncomment actions are overridden by language servers
itsaky-adfa Apr 16, 2026
429e500
fix: invalid label for uncomment line action
itsaky-adfa Apr 16, 2026
d109866
Merge branch 'stage' into feat/ADFA-3320-non-imported-ext-func-comple…
itsaky-adfa Apr 20, 2026
083388b
Merge branch 'feat/ADFA-3320-non-imported-ext-func-completions' into …
itsaky-adfa Apr 20, 2026
26406cc
Merge branch 'stage' into feat/ADFA-3581-source-index
itsaky-adfa Apr 20, 2026
81f403d
fix: remove unused duplicate file
itsaky-adfa Apr 20, 2026
14416c3
Merge branch 'feat/ADFA-3581-source-index' into fix/ADFA-3721-remove-…
itsaky-adfa Apr 20, 2026
9e079cf
Merge branch 'stage' into fix/ADFA-3721-remove-unused-modules
itsaky-adfa Apr 20, 2026
bb2c2bf
Merge branch 'fix/ADFA-3721-remove-unused-modules' into feat/ADFA-358…
itsaky-adfa Apr 20, 2026
4816292
Merge branch 'stage' into feat/ADFA-3582-kotlin-snippets
itsaky-adfa Apr 20, 2026
c9f06cb
fix: compilation error
itsaky-adfa Apr 20, 2026
36555a0
Merge branch 'stage' into feat/ADFA-3582-kotlin-snippets
itsaky-adfa Apr 20, 2026
5ec09ee
fix: compilation error
itsaky-adfa Apr 20, 2026
c01b73d
Merge branch 'feat/ADFA-3582-kotlin-snippets' into feat/ADFA-3740-com…
itsaky-adfa Apr 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ object SnippetHandler {
private val log = LoggerFactory.getLogger(SnippetHandler::class.java)

fun loadUserSnippets() {
loadUserSnippetsForLanguage("java", JavaSnippetScope.entries.toTypedArray())
loadUserSnippetsForLanguage("java", JavaSnippetScope.entries)
loadUserSnippetsForLanguage("xml", XML_SNIPPET_SCOPES)
}

Expand Down Expand Up @@ -50,7 +50,7 @@ object SnippetHandler {

private fun <S : ISnippetScope> loadUserSnippetsForLanguage(
language: String,
scopes: Array<S>,
scopes: Iterable<S>,
) {
SnippetRegistry.clearUserSnippets(language)
val userSnippets = UserSnippetLoader.loadUserSnippets(language, scopes)
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/itsaky/androidide/ui/CodeEditorView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import com.itsaky.androidide.lsp.IDELanguageClientImpl
import com.itsaky.androidide.lsp.api.ILanguageServer
import com.itsaky.androidide.lsp.api.ILanguageServerRegistry
import com.itsaky.androidide.lsp.java.JavaLanguageServer
import com.itsaky.androidide.lsp.kotlin.KotlinLanguageServer
import com.itsaky.androidide.lsp.xml.XMLLanguageServer
import com.itsaky.androidide.models.Range
import com.itsaky.androidide.preferences.internal.EditorPreferences
Expand Down Expand Up @@ -545,6 +546,7 @@ class CodeEditorView(
val serverID: String =
when (file.extension) {
"java" -> JavaLanguageServer.SERVER_ID
"kt", "kts" -> KotlinLanguageServer.SERVER_ID
"xml" -> XMLLanguageServer.SERVER_ID
else -> return null
}
Expand Down
1 change: 1 addition & 0 deletions lsp/api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ dependencies {
api(projects.lookup)
api(projects.lsp.models)
api(projects.preferences)
api(projects.idetooltips)

compileOnly(projects.actions)
compileOnly(projects.common)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.androidide.lsp.actions

import android.content.Context
import android.graphics.drawable.Drawable
import com.itsaky.androidide.actions.ActionData
import com.itsaky.androidide.actions.ActionItem
import com.itsaky.androidide.actions.EditorActionItem
import com.itsaky.androidide.actions.hasRequiredData
import com.itsaky.androidide.actions.markInvisible
import com.itsaky.androidide.actions.requireContext
import com.itsaky.androidide.actions.requireEditor
import com.itsaky.androidide.actions.requireFile
import com.itsaky.androidide.idetooltips.TooltipTag
import com.itsaky.androidide.resources.R
import io.github.rosemoe.sora.text.batchEdit
import java.io.File

/** @author Akash Yadav */
class CommentLineAction(
lang: String,
private val targetFileExtensions: List<String>,
private val lineCommentToken: String,
) : EditorActionItem {

constructor(lang: String, extension: String, lineCommentToken: String) :
this(lang, listOf(extension), lineCommentToken)
override val id: String = "ide.editor.lsp.$lang.commentLine"
override var label: String = ""

override var visible = true
override var enabled = true
override var icon: Drawable? = null
override var location: ActionItem.Location = ActionItem.Location.EDITOR_CODE_ACTIONS
override var requiresUIThread: Boolean = true
override var tooltipTag: String = TooltipTag.EDITOR_CODE_ACTIONS_COMMENT

override fun prepare(data: ActionData) {
super.prepare(data)

if (!data.hasRequiredData(Context::class.java, File::class.java)) {
markInvisible()
return
}

val context = data.requireContext()
label = context.getString(R.string.action_comment_line)

val file = data.requireFile()
if (file.extension !in targetFileExtensions) {
markInvisible()
return
}
}

override suspend fun execAction(data: ActionData): Boolean {
val editor = data.requireEditor()
val text = editor.text
val cursor = editor.cursor

text.batchEdit {
for (line in cursor.leftLine..cursor.rightLine) {
text.insert(line, 0, lineCommentToken)
}
}

return true
}

override fun dismissOnAction() = true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.androidide.lsp.actions

import android.content.Context
import android.graphics.drawable.Drawable
import com.itsaky.androidide.actions.ActionData
import com.itsaky.androidide.actions.ActionItem
import com.itsaky.androidide.actions.EditorActionItem
import com.itsaky.androidide.actions.hasRequiredData
import com.itsaky.androidide.actions.markInvisible
import com.itsaky.androidide.actions.requireContext
import com.itsaky.androidide.actions.requireEditor
import com.itsaky.androidide.actions.requireFile
import com.itsaky.androidide.idetooltips.TooltipTag
import com.itsaky.androidide.resources.R
import io.github.rosemoe.sora.text.batchEdit
import java.io.File

/** @author Akash Yadav */
class UncommentLineAction(
lang: String,
private val targetFileExtensions: List<String>,
private val lineCommentToken: String,
) : EditorActionItem {

constructor(lang: String, extension: String, lineCommentToken: String) :
this(lang, listOf(extension), lineCommentToken)

override val id: String = "ide.editor.lsp.$lang.uncommentLine"
override var label: String = ""

override var visible = true
override var enabled = true
override var icon: Drawable? = null
override var location: ActionItem.Location = ActionItem.Location.EDITOR_CODE_ACTIONS
override var requiresUIThread: Boolean = true
override var tooltipTag: String = TooltipTag.EDITOR_CODE_ACTIONS_UNCOMMENT


override fun prepare(data: ActionData) {
super.prepare(data)

if (!data.hasRequiredData(Context::class.java, File::class.java)) {
markInvisible()
return
}

val context = data.requireContext()
label = context.getString(R.string.action_uncomment_line)

val file = data.requireFile()
if (file.extension !in targetFileExtensions) {
markInvisible()
return
}
}

override suspend fun execAction(data: ActionData): Boolean {
val editor = data.requireEditor()
val text = editor.text
val cursor = editor.cursor

text.batchEdit {
for (line in cursor.leftLine..cursor.rightLine) {
val l = text.getLineString(line)
if (l.trim().startsWith(lineCommentToken)) {
val i = l.indexOf(lineCommentToken)
text.delete(line, i, line, i + 2)
}
}
}

return true
}

override fun dismissOnAction() = true
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ object SnippetParser {

fun <S : ISnippetScope> parse(
lang: String,
scopes: Array<S>,
scopes: Iterable<S>,
snippetFactory: (String, String, List<String>) -> ISnippet = { prefix, desc, body ->
DefaultSnippet(prefix, desc, body.toTypedArray())
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ object SnippetRegistry {
return scopes.flatMap { getSnippets(language, it) }
}

fun <S : ISnippetScope> initBuiltIn(language: String, scopes: Array<S>) {
fun <S : ISnippetScope> initBuiltIn(language: String, scopes: Iterable<S>) {
val parsed = SnippetParser.parse(language, scopes)
lock.write {
parsed.forEach { (scope, snippets) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object UserSnippetLoader {

fun <S : ISnippetScope> loadUserSnippets(
language: String,
scopes: Array<S>,
scopes: Iterable<S>,
): Map<String, List<ISnippet>> {
val langDir = getUserSnippetsDir(language)
if (!langDir.isDirectory) return emptyMap()
Expand Down
3 changes: 3 additions & 0 deletions lsp/indexing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ dependencies {
api(libs.kotlinx.coroutines.core)

api(projects.logger)

testImplementation(projects.testing.unit)
testImplementation(libs.tests.kotlinx.coroutines)
}
Loading
Loading