Просмотр исходного кода

add dev2main git alias + use lsp for formatting java + add (broken) kotlin config

Noah Vogt 1 день назад
Родитель
Сommit
5f9d9c3f85
2 измененных файлов с 21 добавлено и 3 удалено
  1. 1 0
      dot-config/aliasrc
  2. 20 3
      dot-config/nvim/lua/lsp.lua

+ 1 - 0
dot-config/aliasrc

@@ -86,6 +86,7 @@ alias branch='git branch'
 alias lsc='git log --graph --oneline --decorate --all'
 alias lsb="git log --graph --simplify-by-decoration --pretty=format:'%d' --all"
 alias lst="git log --graph --decorate --all --date=short --abbrev-commit --oneline --pretty=format:'%h%x09%an%x09%ad%x09%s'"
+alias dev2main='git checkout dev && git pull && git checkout main && git pull && git merge dev && git push'
 
 # ~/ cleanup
 alias yarn="yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config"

+ 20 - 3
dot-config/nvim/lua/lsp.lua

@@ -74,12 +74,29 @@ vim.lsp.config('veridian', {
 })
 vim.lsp.enable('veridian')
 
--- 4. Formatting (Replaces coc's formatOnSave)
+-- Official JetBrains Kotlin LSP
+vim.lsp.config('kotlin_lsp', {
+  cmd = { 'kotlin-lsp' },
+  filetypes = { 'kotlin' },
+  -- Tell the LSP to attach at the root of your Android Gradle project
+  root_markers = { 'settings.gradle.kts', 'settings.gradle', 'build.gradle.kts', 'build.gradle' },
+  capabilities = capabilities,
+  on_attach = on_attach,
+
+  -- Note: We drop the old fwcd/kotlin-language-server 'settings' block.
+  -- The JetBrains server is much smarter and infers JVM targets, hints,
+  -- and completions directly from IntelliJ's internal engine and your Gradle model.
+})
+vim.lsp.set_log_level("trace")
+vim.lsp.enable('kotlin_lsp')
+
+-- 4. Formatting
 local conform = require("conform")
 conform.setup({
   formatters_by_ft = {
+    kotlin = { "ktlint" },
     python = { "black" },
-    java = { "google-java-format" },
+    java = { "lsp" },
     sh = { "shfmt" },
     rust = { "rustfmt" },
     c = { "clang-format" },
@@ -92,7 +109,7 @@ conform.setup({
   },
 })
 
--- 5. Linting (Replaces coc's pylint and shellcheck)
+-- 5. Linting
 local lint = require("lint")
 lint.linters_by_ft = {
   python = { "pylint" },