From c3b7f039e30d5ab49b1b6adc4605e65827c4d81a Mon Sep 17 00:00:00 2001 From: Crizomb Date: Mon, 29 Sep 2025 15:32:39 +0200 Subject: [PATCH] init --- config.toml | 30 ++++++ languages.toml | 48 +++++++++ snippets/go.json | 264 +++++++++++++++++++++++++++++++++++++++++++++++ themes/edge_neon | 25 +++++ 4 files changed, 367 insertions(+) create mode 100644 config.toml create mode 100644 languages.toml create mode 100644 snippets/go.json create mode 100644 themes/edge_neon diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..22efd3e --- /dev/null +++ b/config.toml @@ -0,0 +1,30 @@ +theme = "tokyonight" + +[editor] +line-number = "relative" +cursorline = true + +[editor.inline-diagnostics] +cursor-line = "warning" # Show warnings and errors inline on the cursor line +other-lines = "disable" # Disable diagnostics on non-cursor lines + +[keys.normal] +C-right = "move_next_word_start" +C-left = "move_prev_word_end" +S-right = "extend_char_right" +S-left = "extend_char_left" +"C-&" = "switch_to_uppercase" +"C-é" = "switch_to_lowercase" +"X" = "select_line_above" + +[keys.insert] +C-right = "move_next_word_start" +C-left = "move_prev_word_end" +S-right = "extend_char_right" +S-left = "extend_char_left" + +[keys.select] +C-right = "extend_next_word_start" +C-left = "extend_prev_word_end" +S-right = "extend_char_right" +S-left = "extend_char_left" diff --git a/languages.toml b/languages.toml new file mode 100644 index 0000000..d348958 --- /dev/null +++ b/languages.toml @@ -0,0 +1,48 @@ +# introduce new language server +[language-server.scls] +command = "simple-completion-language-server" + +[language-server.scls.config] +feature_words = false # enable completion by word +feature_snippets = true # enable snippets +snippets_first = true # completions will return before snippets by default +snippets_inline_by_word_tail = false # suggest snippets by WORD tail, for example text `xsq|` become `x^2|` when snippet `sq` has body `^2` +feature_unicode_input = false # enable "unicode input" +feature_paths = false # enable path completion +feature_citations = false # enable citation completion (only on `citation` feature enabled) + + +# write logs to /tmp/completion.log +[language-server.scls.environment] +RUST_LOG = "info,simple-completion-language-server=info" +LOG_FILE = "/tmp/completion.log" + +[language-server.godot] +command = "nc" +args = [ "127.0.0.1", "6005"] + +[[language]] +name = "gdscript" +language-servers = [ "godot" ] + +[[language]] +name = "go" +auto-format = true +language-servers = ["scls", "gopls", "golangci-lint2-langserver"] +formatter = { command = "goimports" } + +[language-server.golangci-lint2-langserver] +command = "golangci-lint-langserver" + +[language-server.golangci-lint2-langserver.config] +command = [ + "golangci-lint", + "run", + "--output.json.path", + "stdout", + "--show-stats=false", + "--issues-exit-code=1", +] + + + diff --git a/snippets/go.json b/snippets/go.json new file mode 100644 index 0000000..9457937 --- /dev/null +++ b/snippets/go.json @@ -0,0 +1,264 @@ +{ + + "single import": { + "prefix": "im", + "body": "import \"${1:package}\"", + "description": "Snippet for import statement" + }, + "multiple imports": { + "prefix": "ims", + "body": "import (\n\t\"${1:package}\"\n)", + "description": "Snippet for a import block" + }, + "single constant": { + "prefix": "co", + "body": "const ${1:name} = ${2:value}", + "description": "Snippet for a constant" + }, + "multiple constants": { + "prefix": "cos", + "body": "const (\n\t${1:name} = ${2:value}\n)", + "description": "Snippet for a constant block" + }, + "type interface declaration": { + "prefix": "tyi", + "body": "type ${1:name} interface {\n\t$0\n}", + "description": "Snippet for a type interface" + }, + "type struct declaration": { + "prefix": "tys", + "body": "type ${1:name} struct {\n\t$0\n}", + "description": "Snippet for a struct declaration" + }, + "package main and main function": { + "prefix": "pkgm", + "body": "package main\n\nfunc main() {\n\t$0\n}", + "description": "Snippet for main package & function" + }, + "function declaration": { + "prefix": "func", + "body": "func $1($2) $3 {\n\t$0\n}", + "description": "Snippet for function declaration" + }, + "variable declaration": { + "prefix": "var", + "body": "var ${1:name} ${2:type}", + "description": "Snippet for a variable" + }, + "switch statement": { + "prefix": "switch", + "body": "switch ${1:expression} {\ncase ${2:condition}:\n\t$0\n}", + "description": "Snippet for switch statement" + }, + "select statement": { + "prefix": "sel", + "body": "select {\ncase ${1:condition}:\n\t$0\n}", + "description": "Snippet for select statement" + }, + "case clause": { + "prefix": "cs", + "body": "case ${1:condition}:$0", + "description": "Snippet for case clause" + }, + "for statement": { + "prefix": "for", + "body": "for ${1:i} := 0; $1 < ${2:count}; $1${3:++} {\n\t$0\n}", + "description": "Snippet for a for loop" + }, + "for range statement": { + "prefix": "forr", + "body": "for ${1:_, }${2:var} := range ${3:var} {\n\t$0\n}", + "description": "Snippet for a for range loop" + }, + "channel declaration": { + "prefix": "ch", + "body": "chan ${1:type}", + "description": "Snippet for a channel" + }, + "map declaration": { + "prefix": "map", + "body": "map[${1:type}]${2:type}", + "description": "Snippet for a map" + }, + "empty interface": { + "prefix": "in", + "body": "interface{}", + "description": "Snippet for empty interface" + }, + "if statement": { + "prefix": "if", + "body": "if ${1:condition} {\n\t$0\n}", + "description": "Snippet for if statement" + }, + "else branch": { + "prefix": "el", + "body": "else {\n\t$0\n}", + "description": "Snippet for else branch" + }, + "if else statement": { + "prefix": "ie", + "body": "if ${1:condition} {\n\t$2\n} else {\n\t$0\n}", + "description": "Snippet for if else" + }, + "if err != nil": { + "prefix": "iferr", + "body": "if err != nil {\n\t${1:return ${2:nil, }${3:err}}\n}", + "description": "Snippet for if err != nil" + }, + "if err panic": { + "prefix": "errpanic", + "body": "if err != nil {\n\tpanic(err)\n}", + "description": "Snippet for if err != nil with panic" + }, + "fmt.Println": { + "prefix": "fp", + "body": "fmt.Println(\"$1\")", + "description": "Snippet for fmt.Println()" + }, + "fmt.Printf": { + "prefix": "ff", + "body": "fmt.Printf(\"$1\", ${2:var})", + "description": "Snippet for fmt.Printf()" + }, + "log.Println": { + "prefix": "lp", + "body": "log.Println(\"$1\")", + "description": "Snippet for log.Println()" + }, + "log.Printf": { + "prefix": "lf", + "body": "log.Printf(\"$1\", ${2:var})", + "description": "Snippet for log.Printf()" + }, + "log variable content": { + "prefix": "lv", + "body": "log.Printf(\"${1:var}: %#+v\\\\n\", ${1:var})", + "description": "Snippet for log.Printf() with variable content" + }, + "t.Log": { + "prefix": "tl", + "body": "t.Log(\"$1\")", + "description": "Snippet for t.Log()" + }, + "t.Logf": { + "prefix": "tlf", + "body": "t.Logf(\"$1\", ${2:var})", + "description": "Snippet for t.Logf()" + }, + "t.Logf variable content": { + "prefix": "tlv", + "body": "t.Logf(\"${1:var}: %#+v\\\\n\", ${1:var})", + "description": "Snippet for t.Logf() with variable content" + }, + "make(...)": { + "prefix": "make", + "body": "make(${1:type}, ${2:0})", + "description": "Snippet for make statement" + }, + "new(...)": { + "prefix": "new", + "body": "new(${1:type})", + "description": "Snippet for new statement" + }, + "panic(...)": { + "prefix": "pn", + "body": "panic(\"$0\")", + "description": "Snippet for panic" + }, + "http ResponseWriter *Request": { + "prefix": "wr", + "body": "${1:w} http.ResponseWriter, ${2:r} *http.Request", + "description": "Snippet for http Response" + }, + "http.HandleFunc": { + "prefix": "hf", + "body": "${1:http}.HandleFunc(\"${2:/}\", ${3:handler})", + "description": "Snippet for http.HandleFunc()" + }, + "http handler declaration": { + "prefix": "hand", + "body": "func $1(${2:w} http.ResponseWriter, ${3:r} *http.Request) {\n\t$0\n}", + "description": "Snippet for http handler declaration" + }, + "http.Redirect": { + "prefix": "rd", + "body": "http.Redirect(${1:w}, ${2:r}, \"${3:/}\", ${4:http.StatusFound})", + "description": "Snippet for http.Redirect()" + }, + "http.Error": { + "prefix": "herr", + "body": "http.Error(${1:w}, ${2:err}.Error(), ${3:http.StatusInternalServerError})", + "description": "Snippet for http.Error()" + }, + "http.ListenAndServe": { + "prefix": "las", + "body": "http.ListenAndServe(\"${1::8080}\", ${2:nil})", + "description": "Snippet for http.ListenAndServe" + }, + "http.Serve": { + "prefix": "sv", + "body": "http.Serve(\"${1::8080}\", ${2:nil})", + "description": "Snippet for http.Serve" + }, + "goroutine anonymous function": { + "prefix": "go", + "body": "go func($1) {\n\t$0\n}($2)", + "description": "Snippet for anonymous goroutine declaration" + }, + "goroutine function": { + "prefix": "gf", + "body": "go ${1:func}($0)", + "description": "Snippet for goroutine declaration" + }, + "defer statement": { + "prefix": "df", + "body": "defer ${1:func}($0)", + "description": "Snippet for defer statement" + }, + "test function": { + "prefix": "tf", + "body": "func Test$1(t *testing.T) {\n\t$0\n}", + "description": "Snippet for Test function" + }, + "benchmark function": { + "prefix": "bf", + "body": "func Benchmark$1(b *testing.B) {\n\tfor ${2:i} := 0; ${2:i} < b.N; ${2:i}++ {\n\t\t$0\n\t}\n}", + "description": "Snippet for Benchmark function" + }, + "example function": { + "prefix": "ef", + "body": "func Example$1() {\n\t$2\n\t//Output:\n\t$3\n}", + "description": "Snippet for Example function" + }, + "table driven test": { + "prefix": "tdt", + "body": "func Test$1(t *testing.T) {\n\ttestCases := []struct {\n\t\tdesc\tstring\n\t\t$2\n\t}{\n\t\t{\n\t\t\tdesc: \"$3\",\n\t\t\t$4\n\t\t},\n\t}\n\tfor _, tC := range testCases {\n\t\tt.Run(tC.desc, func(t *testing.T) {\n\t\t\t$0\n\t\t})\n\t}\n}", + "description": "Snippet for table driven test" + }, + "init function": { + "prefix": "finit", + "body": "func init() {\n\t$1\n}", + "description": "Snippet for init function" + }, + "main function": { + "prefix": "fmain", + "body": "func main() {\n\t$1\n}", + "description": "Snippet for main function" + }, + "method declaration": { + "prefix": "meth", + "body": "func (${1:receiver} ${2:type}) ${3:method}($4) $5 {\n\t$0\n}", + "description": "Snippet for method declaration" + }, + "hello world web app": { + "prefix": "helloweb", + "body": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"time\"\n)\n\nfunc greet(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"Hello World! %s\", time.Now())\n}\n\nfunc main() {\n\thttp.HandleFunc(\"/\", greet)\n\thttp.ListenAndServe(\":8080\", nil)\n}", + "description": "Snippet for sample hello world webapp" + }, + "sort implementation": { + "prefix": "sort", + "body": "type ${1:SortBy} []${2:Type}\n\nfunc (a $1) Len() int { return len(a) }\nfunc (a $1) Swap(i, j int) { a[i], a[j] = a[j], a[i] }\nfunc (a $1) Less(i, j int) bool { ${3:return a[i] < a[j]} }", + "description": "Snippet for a custom sort.Sort interface implementation, for a given slice type." + } + +} diff --git a/themes/edge_neon b/themes/edge_neon new file mode 100644 index 0000000..41120a6 --- /dev/null +++ b/themes/edge_neon @@ -0,0 +1,25 @@ +black = "#202023" +bg0 = "#2b2d3a" +bg1 = "#333648" +bg2 = "#363a4e" +bg3 = "#393e53" +bg4 = "#3f445b" +bg_grey = "#7a819d" +bg_red = "#ec7279" +diff_red = "#55393d" +bg_green = "#a0c980" +diff_green = "#394634" +bg_blue = "#6cb6eb" +diff_blue = "#354157" +bg_purple = "#d38aea" +diff_yellow = "#4e432f" +fg = "#c5cdd9" +red = "#ec7279" +orange = "#e59b77" # added for compatibility with `sonokai` scheme +yellow = "#deb974" +green = "#a0c980" +cyan = "#5dbbc1" +blue = "#6cb6eb" +purple = "#d38aea" +grey = "#7e8294" +grey_dim = "#5c6071"