Skip to content

Commit

Permalink
fix: sqlite always not work and another things
Browse files Browse the repository at this point in the history
this is a huge pr.. before I think this project won't maintain anymore
so I work myself, and follow another fork.. but that one also inactive

I will pr for this

This pr induced typos ci, dependabot, bump a lot of dependencies, make
format, remove deperate function and etc
  • Loading branch information
Decodetalkers committed Jan 19, 2025
1 parent 18e65bc commit a9aa5c5
Show file tree
Hide file tree
Showing 76 changed files with 1,338 additions and 923 deletions.
33 changes: 33 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

# docs
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "weekly"
# We release on Tuesdays and open dependabot PRs will rebase after the
# version bump and thus consume unnecessary workers during release, thus
# let's open new ones on Wednesday
day: "wednesday"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-patch"]
groups:
# Only update polars as a whole as there are many subcrates that need to
# be updated at once. We explicitly depend on some of them, so batch their
# updates to not take up dependabot PR slots with dysfunctional PRs
polars:
patterns:
- "polars"
- "polars-*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "wednesday"
8 changes: 5 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build
on:
push:
branches:
- main
- master
pull_request:
workflow_dispatch:

Expand All @@ -17,12 +17,14 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3
with:
cache-disabled: ${{ contains(matrix.os, 'windows') }}
- name: Build
run: ./gradlew :server:build :shared:build -PjavaVersion=${{ matrix.java }}
- name: Detekt
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/typos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
# yamllint disable rule:line-length
name: check_typos

on: # yamllint disable-line rule:truthy
push:
pull_request:
branches:
- '**'

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: typos-action
uses: crate-ci/typos@v1.29.4
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ build
target
out

# Kotlin
.kotlin

# Python
__pycache__

Expand All @@ -32,3 +29,4 @@ node_modules
!.vscode/tasks.json
*.vsix
kls_database.db
.kotlin
6 changes: 6 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[files]
extend-exclude = ["server/src/test/resources/completions/*.kt"]

[default.extend-words]
ba = "ba"
vertx = "vertx"
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ detekt {
// Registers a baseline for Detekt.
//
// The way it works is that you set create "baseline" for Detekt
// by running this task. It will then creatae a detekt-baseline.xml which
// by running this task. It will then create a detekt-baseline.xml which
// contains a list of current issues found within the project.
// Then every time you run the "detekt" task it will only report errors
// that are not in the baseline config.
Expand All @@ -33,6 +33,7 @@ detekt {
// fix detekt issues so that we can prevent regressions.
tasks.register<DetektCreateBaselineTask>("createDetektBaseline") {
description = "Overrides current baseline."
group = "verification"
buildUponDefaultConfig.set(true)
ignoreFailures.set(true)
parallel.set(true)
Expand Down
9 changes: 9 additions & 0 deletions detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ comments:

complexity:
excludes: *standardExcludes
CyclomaticComplexMethod:
threshold: 25
NestedBlockDepth:
threshold: 10

empty-blocks:
excludes: *standardExcludes
Expand All @@ -24,6 +28,8 @@ exceptions:
- NumberFormatException
- ParseException
- MissingPropertyException
TooGenericExceptionCaught:
active: false

naming:
excludes: *standardExcludes
Expand All @@ -38,6 +44,9 @@ style:
excludes: *standardExcludes
MaxLineLength:
active: false
ReturnCount:
active: true
max: 3 # Maximum allowed return statements in a function
WildcardImport:
excludeImports:
- java.util.*
Expand Down
4 changes: 2 additions & 2 deletions detekt_baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<SmellBaseline>
<ManuallySuppressedIssues></ManuallySuppressedIssues>
<CurrentIssues>
<ID>ComplexCondition:SemanticTokens.kt$element is KtVariableDeclaration &amp;&amp; (!element.isVar || element.hasModifier(KtTokens.CONST_KEYWORD)) || element is KtParameter</ID>
<ID>ComplexCondition:SemanticTokens.kt$element is KtVariableDeclaration &amp;&amp; (!element.isVar() || element.hasModifier(KtTokens.CONST_KEYWORD)) || element is KtParameter</ID>
<ID>CyclomaticComplexMethod:Completions.kt$private fun elementCompletions(file: CompiledFile, cursor: Int, surroundingElement: KtElement): Sequence&lt;DeclarationDescriptor&gt;</ID>
<ID>CyclomaticComplexMethod:Completions.kt$private fun indexCompletionItems(file: CompiledFile, cursor: Int, element: KtElement?, index: SymbolIndex, partial: String): Sequence&lt;CompletionItem&gt;</ID>
<ID>CyclomaticComplexMethod:GoToDefinition.kt$fun goToDefinition( file: CompiledFile, cursor: Int, classContentProvider: ClassContentProvider, tempDir: TemporaryDirectory, config: ExternalSourcesConfiguration, cp: CompilerClassPath ): Location?</ID>
Expand All @@ -26,7 +26,7 @@
<ID>EmptyClassBlock:samefile.kt$MyImplClass${}</ID>
<ID>EmptyClassBlock:samefile.kt$NullClass${}</ID>
<ID>EmptyClassBlock:samefile.kt$PrintableClass${}</ID>
<ID>EmptyClassBlock:standardlib.kt$MyComperable${}</ID>
<ID>EmptyClassBlock:standardlib.kt$MyComparable${}</ID>
<ID>EmptyClassBlock:standardlib.kt$MyList${}</ID>
<ID>EmptyClassBlock:standardlib.kt$MyThread${}</ID>
<ID>EmptyDefaultConstructor:BigFile.kt$BigFile.A$()</ID>
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=1.3.14
version=1.3.13
javaVersion=11
21 changes: 13 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[versions]
kotlinVersion = "2.1.0"
lsp4jVersion = "0.21.2"
exposedVersion = "0.37.3"
lsp4jVersion = "0.23.1"
exposedVersion = "0.58.0"
jmhVersion = "1.20"
guavaVersion = "33.3.0-jre"
slf4j = "2.0.16"
gruavaVersion = "33.4.0-jre"

[libraries]
org-jetbrains-kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlinVersion" }
Expand Down Expand Up @@ -32,7 +33,7 @@ org-jetbrains-fernflower = { module = "org.jetbrains:fernflower", version = "1.0

com-github-fwcd-ktfmt = { module = "com.github.fwcd.ktfmt:ktfmt", version = "b5d31d1" }

com-google-guava-guava = { module = "com.google.guava:guava", version.ref = "guavaVersion" }
com-google-guava.guava = { module = "com.google.guava:guava", version.ref = "gruava" }

com-h2database-h2 = { module = "com.h2database:h2", version = "1.4.200" }

Expand All @@ -41,12 +42,16 @@ com-beust-jcommander = { module = "com.beust:jcommander", version = "1.78" }
org-openjdk-jmh-generator-annprocess = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "jmhVersion" }
org-openjdk-jmh-core = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmhVersion" }

org-xerial-sqlite-jdbc = { module = "org.xerial:sqlite-jdbc", version = "3.41.2.1" }
org-xerial-sqlite-jdbc = { module = "org.xerial:sqlite-jdbc", version = "3.48.0.0" }

# buildSrc
org-jetbrains-kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin",version.ref = "kotlinVersion" }
org-jetbrains-kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlinVersion" }

org-slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
org-slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" }


[plugins]
com-github-jk1-tcdeps = { id = "com.github.jk1.tcdeps", version = "1.2" }
com-jaredsburrows-license = { id = "com.jaredsburrows.license", version = "0.8.42" }
com-github-jk1-tcdeps = { id = "com.github.jk1.tcdeps", version = "1.6.2" }
com-jaredsburrows-license = { id = "com.jaredsburrows.license", version = "0.9.8" }
io-gitlab-arturbosch-detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.22.0" }
32 changes: 28 additions & 4 deletions server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ plugins {
id("kotlin-language-server.kotlin-conventions")
}

val serverDebugPort = 4000
val debugPort = 8000
val debugArgs = "-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n,quiet=y"
val debugArgs = "-agentlib:jdwp=transport=dt_socket,server=y,address=$debugPort,suspend=n,quiet=y"

val serverMainClassName = "org.javacs.kt.MainKt"
val applicationName = "kotlin-language-server"
Expand All @@ -20,8 +21,21 @@ application {
description = "Code completions, diagnostics and more for Kotlin"
applicationDefaultJvmArgs = listOf("-DkotlinLanguageServer.version=$version")
applicationDistribution.into("bin") {
filePermissions { unix("755".toInt(radix = 8)) }
//fileMode = 755
filePermissions {
user {
read = true
execute = true
write = true
}
other {
read = true
write = false
execute = true
}
}
}

}

repositories {
Expand All @@ -43,6 +57,9 @@ dependencies {
implementation(libs.org.eclipse.lsp4j.lsp4j)
implementation(libs.org.eclipse.lsp4j.jsonrpc)

implementation(libs.org.slf4j.api)
implementation(libs.org.slf4j.simple)

implementation(kotlin("compiler"))
implementation(kotlin("scripting-compiler"))
implementation(kotlin("scripting-jvm-host-unshaded"))
Expand Down Expand Up @@ -74,8 +91,8 @@ configurations.forEach { config -> config.resolutionStrategy { preferProjectModu
tasks.startScripts { applicationName = "kotlin-language-server" }

tasks.register<Exec>("fixFilePermissions") {
// When running on macOS or Linux the start script
// needs executable permissions to run.
group = "Distribution"
description = "Fix file permissions for the start script on macOS or Linux."

onlyIf { !System.getProperty("os.name").lowercase().contains("windows") }
commandLine(
Expand All @@ -86,15 +103,20 @@ tasks.register<Exec>("fixFilePermissions") {
}

tasks.register<JavaExec>("debugRun") {
group = "Application"
description = "Run the application with debugging enabled."
mainClass.set(serverMainClassName)
classpath(sourceSets.main.get().runtimeClasspath)
standardInput = System.`in`

jvmArgs(debugArgs)
args(listOf("--tcpServerPort", serverDebugPort, "--tcpDebug", "--fullLog"))
doLast { println("Using debug port $debugPort") }
}

tasks.register<CreateStartScripts>("debugStartScripts") {
group = "Distribution"
description = "Create start scripts with debug options for the application."
applicationName = "kotlin-language-server"
mainClass.set(serverMainClassName)
outputDir = tasks.installDist.get().destinationDir.toPath().resolve("bin").toFile()
Expand All @@ -103,6 +125,8 @@ tasks.register<CreateStartScripts>("debugStartScripts") {
}

tasks.register<Sync>("installDebugDist") {
group = "Distribution"
description = "Install the debug distribution and create debug start scripts."
dependsOn("installDist")
finalizedBy("debugStartScripts")
}
Expand Down
Loading

0 comments on commit a9aa5c5

Please sign in to comment.