diff --git a/clangdschema.json b/clangdschema.json new file mode 100644 index 0000000..565fdef --- /dev/null +++ b/clangdschema.json @@ -0,0 +1,693 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://json.schemastore.org/clangd.json", + "definitions": { + "oneOrMorePath": { + "oneOf": [ + { + "$ref": "https://json.schemastore.org/base.json#/definitions/path", + "type": "string" + }, + { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "https://json.schemastore.org/base.json#/definitions/path", + "description": "A path pattern\nhttps://clangd.llvm.org/config.html#if" + } + } + ] + }, + "oneOrMoreFlags": { + "oneOf": [ + { + "type": "string", + "minLength": 1 + }, + { + "type": "array", + "uniqueItems": true, + "items": { + "description": "A flag\nhttps://clangd.llvm.org/config.html#compileflags", + "type": "string", + "minLength": 1 + } + } + ] + }, + "clangTidyCheck": { + "type": "string", + "enum": [ + "abseil-cleanup-ctad", + "abseil-duration-addition", + "abseil-duration-comparison", + "abseil-duration-conversion-cast", + "abseil-duration-division", + "abseil-duration-factory-float", + "abseil-duration-factory-scale", + "abseil-duration-subtraction", + "abseil-duration-unnecessary-conversion", + "abseil-faster-strsplit-delimiter", + "abseil-no-internal-dependencies", + "abseil-no-namespace", + "abseil-redundant-strcat-calls", + "abseil-str-cat-append", + "abseil-string-find-startswith", + "abseil-string-find-str-contains", + "abseil-time-comparison", + "abseil-time-subtraction", + "abseil-upgrade-duration-conversions", + "altera-id-dependent-backward-branch", + "altera-kernel-name-restriction", + "altera-single-work-item-barrier", + "altera-struct-pack-align", + "altera-unroll-loops", + "android-cloexec-accept", + "android-cloexec-accept4", + "android-cloexec-creat", + "android-cloexec-dup", + "android-cloexec-epoll-create", + "android-cloexec-epoll-create1", + "android-cloexec-fopen", + "android-cloexec-inotify-init", + "android-cloexec-inotify-init1", + "android-cloexec-memfd-create", + "android-cloexec-open", + "android-cloexec-pipe", + "android-cloexec-pipe2", + "android-cloexec-socket", + "android-comparison-in-temp-failure-retry", + "boost-use-to-string", + "bugprone-argument-comment", + "bugprone-assert-side-effect", + "bugprone-assignment-in-if-condition", + "bugprone-bad-signal-to-kill-thread", + "bugprone-bool-pointer-implicit-conversion", + "bugprone-branch-clone", + "bugprone-copy-constructor-init", + "bugprone-dangling-handle", + "bugprone-dynamic-static-initializers", + "bugprone-easily-swappable-parameters", + "bugprone-exception-escape", + "bugprone-fold-init-type", + "bugprone-forward-declaration-namespace", + "bugprone-forwarding-reference-overload", + "bugprone-implicit-widening-of-multiplication-result", + "bugprone-inaccurate-erase", + "bugprone-incorrect-roundings", + "bugprone-infinite-loop", + "bugprone-integer-division", + "bugprone-lambda-function-name", + "bugprone-macro-parentheses", + "bugprone-macro-repeated-side-effects", + "bugprone-misplaced-operator-in-strlen-in-alloc", + "bugprone-misplaced-pointer-arithmetic-in-alloc", + "bugprone-misplaced-widening-cast", + "bugprone-move-forwarding-reference", + "bugprone-multiple-statement-macro", + "bugprone-no-escape", + "bugprone-not-null-terminated-result", + "bugprone-parent-virtual-call", + "bugprone-posix-return", + "bugprone-redundant-branch-condition", + "bugprone-reserved-identifier", + "bugprone-shared-ptr-array-mismatch", + "bugprone-signal-handler", + "bugprone-signed-char-misuse", + "bugprone-sizeof-container", + "bugprone-sizeof-expression", + "bugprone-spuriously-wake-up-functions", + "bugprone-standalone-empty", + "bugprone-string-constructor", + "bugprone-string-integer-assignment", + "bugprone-string-literal-with-embedded-nul", + "bugprone-stringview-nullptr", + "bugprone-suspicious-enum-usage", + "bugprone-suspicious-include", + "bugprone-suspicious-memory-comparison", + "bugprone-suspicious-memset-usage", + "bugprone-suspicious-missing-comma", + "bugprone-suspicious-realloc-usage", + "bugprone-suspicious-semicolon", + "bugprone-suspicious-string-compare", + "bugprone-swapped-arguments", + "bugprone-terminating-continue", + "bugprone-throw-keyword-missing", + "bugprone-too-small-loop-variable", + "bugprone-unchecked-optional-access", + "bugprone-undefined-memory-manipulation", + "bugprone-undelegated-constructor", + "bugprone-unhandled-exception-at-new", + "bugprone-unhandled-self-assignment", + "bugprone-unused-raii", + "bugprone-unused-return-value", + "bugprone-use-after-move", + "bugprone-virtual-near-miss", + "cert-dcl21-cpp", + "cert-dcl50-cpp", + "cert-dcl58-cpp", + "cert-env33-c", + "cert-err33-c", + "cert-err34-c", + "cert-err52-cpp", + "cert-err58-cpp", + "cert-err60-cpp", + "cert-flp30-c", + "cert-mem57-cpp", + "cert-msc50-cpp", + "cert-msc51-cpp", + "cert-oop57-cpp", + "cert-oop58-cpp", + "clang-analyzer-core.DynamicTypePropagation", + "clang-analyzer-core.uninitialized.CapturedBlockVariable", + "clang-analyzer-cplusplus.InnerPointer", + "clang-analyzer-nullability.NullableReturnedFromNonnull", + "clang-analyzer-optin.osx.OSObjectCStyleCast", + "clang-analyzer-optin.performance.GCDAntipattern", + "clang-analyzer-optin.performance.Padding", + "clang-analyzer-optin.portability.UnixAPI", + "clang-analyzer-osx.MIG", + "clang-analyzer-osx.NumberObjectConversion", + "clang-analyzer-osx.OSObjectRetainCount", + "clang-analyzer-osx.ObjCProperty", + "clang-analyzer-osx.cocoa.AutoreleaseWrite", + "clang-analyzer-osx.cocoa.Loops", + "clang-analyzer-osx.cocoa.MissingSuperCall", + "clang-analyzer-osx.cocoa.NonNilReturnValue", + "clang-analyzer-osx.cocoa.RunLoopAutoreleaseLeak", + "clang-analyzer-valist.CopyToSelf", + "clang-analyzer-valist.Uninitialized", + "clang-analyzer-valist.Unterminated", + "concurrency-mt-unsafe", + "concurrency-thread-canceltype-asynchronous", + "cppcoreguidelines-avoid-const-or-ref-data-members", + "cppcoreguidelines-avoid-do-while", + "cppcoreguidelines-avoid-goto", + "cppcoreguidelines-avoid-non-const-global-variables", + "cppcoreguidelines-avoid-reference-coroutine-parameters", + "cppcoreguidelines-init-variables", + "cppcoreguidelines-interfaces-global-init", + "cppcoreguidelines-macro-usage", + "cppcoreguidelines-narrowing-conversions", + "cppcoreguidelines-no-malloc", + "cppcoreguidelines-owning-memory", + "cppcoreguidelines-prefer-member-initializer", + "cppcoreguidelines-pro-bounds-array-to-pointer-decay", + "cppcoreguidelines-pro-bounds-constant-array-index", + "cppcoreguidelines-pro-bounds-pointer-arithmetic", + "cppcoreguidelines-pro-type-const-cast", + "cppcoreguidelines-pro-type-cstyle-cast", + "cppcoreguidelines-pro-type-member-init", + "cppcoreguidelines-pro-type-reinterpret-cast", + "cppcoreguidelines-pro-type-static-cast-downcast", + "cppcoreguidelines-pro-type-union-access", + "cppcoreguidelines-pro-type-vararg", + "cppcoreguidelines-slicing", + "cppcoreguidelines-special-member-functions", + "cppcoreguidelines-virtual-class-destructor", + "darwin-avoid-spinlock", + "darwin-dispatch-once-nonstatic", + "fuchsia-default-arguments-calls", + "fuchsia-default-arguments-declarations", + "fuchsia-multiple-inheritance", + "fuchsia-overloaded-operator", + "fuchsia-statically-constructed-objects", + "fuchsia-trailing-return", + "fuchsia-virtual-inheritance", + "google-build-explicit-make-pair", + "google-build-namespaces", + "google-build-using-namespace", + "google-default-arguments", + "google-explicit-constructor", + "google-global-names-in-headers", + "google-objc-avoid-nsobject-new", + "google-objc-avoid-throwing-exception", + "google-objc-function-naming", + "google-objc-global-variable-declaration", + "google-readability-avoid-underscore-in-googletest-name", + "google-readability-casting", + "google-readability-todo", + "google-runtime-int", + "google-runtime-operator", + "google-upgrade-googletest-case", + "hicpp-avoid-goto", + "hicpp-exception-baseclass", + "hicpp-multiway-paths-covered", + "hicpp-no-assembler", + "hicpp-signed-bitwise", + "linuxkernel-must-use-errs", + "llvm-header-guard", + "llvm-include-order", + "llvm-namespace-comment", + "llvm-prefer-isa-or-dyn-cast-in-conditionals", + "llvm-prefer-register-over-unsigned", + "llvm-twine-local", + "llvmlibc-callee-namespace", + "llvmlibc-implementation-in-namespace", + "llvmlibc-restrict-system-libc-headers", + "misc-confusable-identifiers", + "misc-const-correctness", + "misc-definitions-in-headers", + "misc-misleading-bidirectional", + "misc-misleading-identifier", + "misc-misplaced-const", + "misc-new-delete-overloads", + "misc-no-recursion", + "misc-non-copyable-objects", + "misc-non-private-member-variables-in-classes", + "misc-redundant-expression", + "misc-static-assert", + "misc-throw-by-value-catch-by-reference", + "misc-unconventional-assign-operator", + "misc-uniqueptr-reset-release", + "misc-unused-alias-decls", + "misc-unused-parameters", + "misc-unused-using-decls", + "misc-use-anonymous-namespace", + "modernize-avoid-bind", + "modernize-avoid-c-arrays", + "modernize-concat-nested-namespaces", + "modernize-deprecated-headers", + "modernize-deprecated-ios-base-aliases", + "modernize-loop-convert", + "modernize-macro-to-enum", + "modernize-make-shared", + "modernize-make-unique", + "modernize-pass-by-value", + "modernize-raw-string-literal", + "modernize-redundant-void-arg", + "modernize-replace-auto-ptr", + "modernize-replace-disallow-copy-and-assign-macro", + "modernize-replace-random-shuffle", + "modernize-return-braced-init-list", + "modernize-shrink-to-fit", + "modernize-unary-static-assert", + "modernize-use-auto", + "modernize-use-bool-literals", + "modernize-use-default-member-init", + "modernize-use-emplace", + "modernize-use-equals-default", + "modernize-use-equals-delete", + "modernize-use-nodiscard", + "modernize-use-noexcept", + "modernize-use-nullptr", + "modernize-use-override", + "modernize-use-trailing-return-type", + "modernize-use-transparent-functors", + "modernize-use-uncaught-exceptions", + "modernize-use-using", + "mpi-buffer-deref", + "mpi-type-mismatch", + "objc-assert-equals", + "objc-avoid-nserror-init", + "objc-dealloc-in-category", + "objc-forbidden-subclassing", + "objc-missing-hash", + "objc-nsdate-formatter", + "objc-nsinvocation-argument-lifetime", + "objc-property-declaration", + "objc-super-self", + "openmp-exception-escape", + "openmp-use-default-none", + "performance-faster-string-find", + "performance-for-range-copy", + "performance-implicit-conversion-in-loop", + "performance-inefficient-algorithm", + "performance-inefficient-string-concatenation", + "performance-inefficient-vector-operation", + "performance-move-const-arg", + "performance-move-constructor-init", + "performance-no-automatic-move", + "performance-no-int-to-ptr", + "performance-noexcept-move-constructor", + "performance-trivially-destructible", + "performance-type-promotion-in-math-fn", + "performance-unnecessary-copy-initialization", + "performance-unnecessary-value-param", + "portability-restrict-system-includes", + "portability-simd-intrinsics", + "portability-std-allocator-const", + "readability-avoid-const-params-in-decls", + "readability-braces-around-statements", + "readability-const-return-type", + "readability-container-contains", + "readability-container-data-pointer", + "readability-container-size-empty", + "readability-convert-member-functions-to-static", + "readability-delete-null-pointer", + "readability-duplicate-include", + "readability-else-after-return", + "readability-function-cognitive-complexity", + "readability-function-size", + "readability-identifier-length", + "readability-identifier-naming", + "readability-implicit-bool-conversion", + "readability-inconsistent-declaration-parameter-name", + "readability-isolate-declaration", + "readability-magic-numbers", + "readability-make-member-function-const", + "readability-misleading-indentation", + "readability-misplaced-array-index", + "readability-named-parameter", + "readability-non-const-parameter", + "readability-qualified-auto", + "readability-redundant-access-specifiers", + "readability-redundant-control-flow", + "readability-redundant-declaration", + "readability-redundant-function-ptr-dereference", + "readability-redundant-member-init", + "readability-redundant-preprocessor", + "readability-redundant-smartptr-get", + "readability-redundant-string-cstr", + "readability-redundant-string-init", + "readability-simplify-boolean-expr", + "readability-simplify-subscript-expr", + "readability-static-accessed-through-instance", + "readability-static-definition-in-anonymous-namespace", + "readability-string-compare", + "readability-suspicious-call-argument", + "readability-uniqueptr-delete-release", + "readability-uppercase-literal-suffix", + "readability-use-anyofallof", + "zircon-temporary-objects" + ] + }, + "oneOrMoreDiagnostics": { + "oneOf": [ + { + "anyOf": [ + { + "type": "string", + "minLength": 1 + }, + { + "$ref": "#/definitions/clangTidyCheck" + } + ] + }, + { + "type": "array", + "uniqueItems": true, + "items": { + "description": "A diagnostic\nhttps://clangd.llvm.org/config.html#clangtidy", + "anyOf": [ + { + "type": "string", + "minLength": 1 + }, + { + "$ref": "#/definitions/clangTidyCheck" + } + ] + } + } + ] + } + }, + "properties": { + "If": { + "title": "conditions", + "description": "Conditions\nhttps://clangd.llvm.org/config.html#if", + "type": "object", + "properties": { + "PathMatch": { + "$ref": "#/definitions/oneOrMorePath", + "description": "Path patterns\nhttps://clangd.llvm.org/config.html#pathmatch", + "examples": [".*\\.h"] + }, + "PathExclude": { + "$ref": "#/definitions/oneOrMorePath", + "description": "An exclude path pattern\nhttps://clangd.llvm.org/config.html#pathexclude", + "examples": ["include/llvm-c/.*"] + } + }, + "additionalProperties": false + }, + "CompileFlags": { + "title": "compilation flags", + "description": "Flag lists to be added or removed\nhttps://clangd.llvm.org/config.html#compileflags", + "type": "object", + "properties": { + "Add": { + "$ref": "#/definitions/oneOrMoreFlags", + "description": "Flags to be added to the compile command\nhttps://clangd.llvm.org/config.html#add", + "examples": [["-xc++", "-Wall"]] + }, + "Remove": { + "$ref": "#/definitions/oneOrMoreFlags", + "description": "Flags to be removed from the compile command\nhttps://clangd.llvm.org/config.html#remove", + "examples": ["-W*"] + }, + "CompilationDatabase": { + "description": "A directory to search for compilation database\nhttps://clangd.llvm.org/config.html#compilationdatabase", + "oneOf": [ + { + "$ref": "https://json.schemastore.org/base.json#/definitions/path" + }, + { + "enum": ["Ancestors", "None"] + } + ] + }, + "Compiler": { + "description": "An `argv[0]` replacement\nhttps://clangd.llvm.org/config.html#compiler", + "type": "string", + "minLength": 1, + "examples": ["clang++"] + } + }, + "additionalProperties": false + }, + "Index": { + "title": "code interpretation", + "description": "Code interpretation outside of the current file", + "type": "object", + "properties": { + "Background": { + "description": "Whether to produce a project index from files built in the background\nhttps://clangd.llvm.org/config.html#background", + "type": "string", + "enum": ["Build", "Skip"], + "default": "Build" + }, + "External": { + "title": "index source", + "description": "An external index source\nhttps://clangd.llvm.org/config.html#external", + "oneOf": [ + { + "type": "string", + "pattern": "[nN][oO][nN][eE]" + }, + { + "required": ["File"], + "properties": { + "File": { + "$ref": "https://json.schemastore.org/base.json#/definitions/path", + "description": "A file\nhttps://clangd.llvm.org/config.html#external", + "examples": ["/abs/path/to/an/index.idx"] + } + }, + "type": "object", + "additionalProperties": false + }, + { + "required": ["Server"], + "properties": { + "Server": { + "description": "A server\nhttps://clangd.llvm.org/config.html#external", + "type": "string", + "examples": ["my.index.server.com:50051"] + }, + "MountPoint": { + "$ref": "https://json.schemastore.org/base.json#/definitions/path", + "description": "A mount point\nhttps://clangd.llvm.org/config.html#external", + "examples": ["/files/under/this/project/"] + } + }, + "type": "object", + "additionalProperties": false + } + ] + }, + "StandardLibrary": { + "description": "Whether to index a standard library\nhttps://clangd.llvm.org/config.html#standardlibrary", + "enum": ["Yes", "No"] + } + }, + "additionalProperties": false + }, + "Style": { + "title": "style", + "description": "A code base style\nhttps://clangd.llvm.org/config.html#style", + "type": "object", + "properties": { + "FullyQualifiedNamespaces": { + "description": "List of fully qualified namespaces\nhttps://clangd.llvm.org/config.html#fullyqualifiednamespaces", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "Diagnostics": { + "title": "diagnostics", + "description": "Diagnostics\nhttps://clangd.llvm.org/config.html#diagnostics", + "type": "object", + "properties": { + "Suppress": { + "description": "Diagnostic codes that to be suppressed\nhttps://clangd.llvm.org/config.html#suppress", + "oneOf": [ + { + "type": "string", + "const": "*" + }, + { + "type": "array", + "uniqueItems": true, + "items": { + "description": "A diagnostic code that to be suppressed\nhttps://clangd.llvm.org/config.html#suppress", + "type": "string", + "minLength": 1 + } + } + ] + }, + "ClangTidy": { + "title": "clangtidy options", + "description": "Clang-Tidy options\nhttps://clangd.llvm.org/config.html#clangtidy", + "type": "object", + "properties": { + "Add": { + "$ref": "#/definitions/oneOrMoreDiagnostics", + "description": "Checks to enable\nhttps://clangd.llvm.org/config.html#add-1", + "examples": ["modernize*"] + }, + "Remove": { + "$ref": "#/definitions/oneOrMoreDiagnostics", + "description": "Checks to disable\nhttps://clangd.llvm.org/config.html#remove-1", + "examples": ["modernize-use-trailing-return-type"] + }, + "CheckOptions": { + "description": "Check's options\nhttps://clangd.llvm.org/config.html#checkoptions", + "type": "object", + "examples": [ + { + "readability-identifier-naming.VariableCase": "CamelCase" + } + ] + } + }, + "additionalProperties": false + }, + "UnusedIncludes": { + "description": "Whether to enable Include Cleaner's unused includes diagnostics\nhttps://clangd.llvm.org/config.html#unusedincludes", + "type": "string", + "enum": ["None", "Strict"], + "default": "Strict" + }, + "Includes": { + "type": "object", + "additionalProperties": false, + "properties": { + "IgnoreHeader": { + "description": "A list of regexes. Include Cleaner will not produce diagnostics for headers whose path is a suffix match for any of these\nhttps://clangd.llvm.org/config.html#ignoreheader", + "type": "array", + "items": { + "type": "string", + "minLength": 1 + } + } + } + }, + "MissingIncludes": { + "description": "Whether to enable Include Cleaner's missing includes diagnostics\nhttps://clangd.llvm.org/config.html#missingincludes", + "type": "string", + "enum": ["None", "Strict"], + "default": "None" + } + }, + "additionalProperties": false + }, + "Completion": { + "title": "completion options", + "description": "Completion options\nhttps://clangd.llvm.org/config.html#completion", + "type": "object", + "properties": { + "AllScopes": { + "description": "Whether to include suggestions from scopes that are not visible\nhttps://clangd.llvm.org/config.html#allscopes", + "type": "boolean" + } + }, + "additionalProperties": false + }, + "InlayHints": { + "title": "inlay-hint options", + "description": "Inlay-hints options\nhttps://clangd.llvm.org/config.html#inlayhints", + "type": "object", + "properties": { + "Enabled": { + "description": "Whether to enable inlay-hints\nhttps://clangd.llvm.org/config.html#enabled", + "type": "boolean" + }, + "ParameterNames": { + "description": "Whether to enable inlay-hints for parameter names in function calls\nhttps://clangd.llvm.org/config.html#parameternames", + "type": "boolean" + }, + "DeducedTypes": { + "description": "Whether to enable inlay-hints for deduced types\nhttps://clangd.llvm.org/config.html#deducedtypes", + "type": "boolean" + }, + "Designators": { + "description": "Whether to enable inlay-hints for designators in aggregate initialization\nhttps://clangd.llvm.org/config.html#designators", + "type": "boolean" + }, + "BlockEnd": { + "description": "A boolean that enables/disables inlay-hints for block end comments\nhttps://clangd.llvm.org/config.html#blockend", + "type": "boolean" + }, + "TypeNameLimit": { + "description": "Character limit for type hints. Hints that would be longer are not shown. 0 means no limit.\nhttps://clangd.llvm.org/config.html#typenamelimit", + "type": "number", + "minimum": 0 + } + }, + "additionalProperties": false + }, + "Hover": { + "title": "hover options", + "description": "Hover card's options\nhttps://clangd.llvm.org/config.html#hover", + "type": "object", + "properties": { + "ShowAKA": { + "description": "Whether to display desugared types\nhttps://clangd.llvm.org/config.html#showaka", + "type": "boolean" + } + }, + "additionalProperties": false + }, + "SemanticTokens": { + "description": "Configure semantic highlighting\nhttps://clangd.llvm.org/config.html#semantic-tokens", + "type": "object", + "additionalProperties": false, + "properties": { + "DisabledKinds": { + "description": "Specify semantic token kinds that clangd should not send to client\nhttps://clangd.llvm.org/config.html#disabledkinds", + "type": "array", + "items": { + "type": "string", + "minLength": 1 + } + }, + "DisabledModifiers": { + "description": "Specify semantic token modifiers that clangd should not send to client\nhttps://clangd.llvm.org/config.html#disabledmodifiers", + "type": "array", + "items": { + "type": "string", + "minLength": 1 + } + } + } + } + }, + "type": "object" +} diff --git a/lua/keymap.lua b/lua/keymap.lua index a078510..29f0c33 100644 --- a/lua/keymap.lua +++ b/lua/keymap.lua @@ -42,3 +42,5 @@ vim.keymap.set({ "i", "n" }, "", vim.cmd.vsplit, {}) -- vscode fold and unfold vim.keymap.set("n", "", "zc", {}) vim.keymap.set("n", "", "zo", {}) +-- clangd switch source/header +vim.keymap.set({ "i", "n" }, "", vim.cmd.ClangdSwitchSourceHeader, { silent = true }) diff --git a/lua/plugins.lua b/lua/plugins.lua index 9ee36ae..45fe6fe 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -11,6 +11,9 @@ local plugins = { { "neovim/nvim-lspconfig", }, + { + "p00f/clangd_extensions.nvim", + }, { "folke/trouble.nvim", dependencies = { "nvim-tree/nvim-web-devicons" }, diff --git a/lua/setupclangdext.lua b/lua/setupclangdext.lua new file mode 100644 index 0000000..1b8b530 --- /dev/null +++ b/lua/setupclangdext.lua @@ -0,0 +1,82 @@ +require("clangd_extensions").setup({ + inlay_hints = { + inline = vim.fn.has("nvim-0.10") == 1, + -- Options other than `highlight' and `priority' only work + -- if `inline' is disabled + -- Only show inlay hints for the current line + only_current_line = false, + -- Event which triggers a refresh of the inlay hints. + -- You can make this { "CursorMoved" } or { "CursorMoved,CursorMovedI" } but + -- not that this may cause higher CPU usage. + -- This option is only respected when only_current_line and + -- autoSetHints both are true. + only_current_line_autocmd = { "CursorHold" }, + -- whether to show parameter hints with the inlay hints or not + show_parameter_hints = true, + -- prefix for parameter hints + parameter_hints_prefix = "<- ", + -- prefix for all the other hints (type, chaining) + other_hints_prefix = "=> ", + -- whether to align to the length of the longest line in the file + max_len_align = false, + -- padding from the left if max_len_align is true + max_len_align_padding = 1, + -- whether to align to the extreme right or not + right_align = false, + -- padding from the right if right_align is true + right_align_padding = 7, + -- The color of the hints + highlight = "Comment", + -- The highlight group priority for extmark + priority = 100, + }, + ast = { + -- These are unicode, should be available in any font + role_icons = { + type = "🄣", + declaration = "🄓", + expression = "🄔", + statement = ";", + specifier = "🄱", + ["template argument"] = "🆃", + }, + kind_icons = { + Compound = "đŸ„Č", + Recovery = "🅁", + TranslationUnit = "🅄", + PackExpansion = "🄿", + TemplateTypeParm = "🅃", + TemplateTemplateParm = "🅃", + TemplateParamObject = "🅃", + }, + --[[ These require codicons (https://github.com/microsoft/vscode-codicons) + role_icons = { + type = "î­Ł", + declaration = "îȘŒ", + expression = "", + specifier = "", + statement = "îȘ†", + ["template argument"] = "îȘ’", + }, + + kind_icons = { + Compound = "îȘ‹", + Recovery = "îȘ‡", + TranslationUnit = "î«©", + PackExpansion = "î©Œ", + TemplateTypeParm = "îȘ’", + TemplateTemplateParm = "îȘ’", + TemplateParamObject = "îȘ’", + }, ]] + + highlights = { + detail = "Comment", + }, + }, + memory_usage = { + border = "none", + }, + symbol_info = { + border = "none", + }, +}) diff --git a/lua/setupformat.lua b/lua/setupformat.lua index 5395c25..d6b712a 100644 --- a/lua/setupformat.lua +++ b/lua/setupformat.lua @@ -11,12 +11,46 @@ require("formatter").setup({ log_level = vim.log.levels.WARN, -- All formatter configurations are opt-in filetype = { + yaml = { + require("formatter.filetypes.yaml").yamlfmt, + function() + return { + exe = "yamlfmt", + args = { "-in" }, + stdin = true, + } + end, + }, -- Formatter configurations for filetype "lua" go here -- and will be executed in order typescript = { require("formatter.filetypes.typescript").eslint_d, util.copyf(defaults.eslint_d), }, + cpp = { + require("formatter.filetypes.c").clangformat, + function() + return { + util.copyf(defaults.clangformat), + } + end, + }, + h = { + require("formatter.filetypes.c").clangformat, + function() + return { + util.copyf(defaults.clangformat), + } + end, + }, + c = { + require("formatter.filetypes.c").clangformat, + function() + return { + util.copyf(defaults.clangformat), + } + end, + }, kotlin = { require("formatter.filetypes.kotlin").ktlint, function() diff --git a/lua/setuplsp.lua b/lua/setuplsp.lua index 55f621d..ace8a5a 100644 --- a/lua/setuplsp.lua +++ b/lua/setuplsp.lua @@ -5,6 +5,24 @@ capabilities.textDocument.foldingRange = { dynamicRegistration = false, lineFoldingOnly = true, } + +require("lspconfig").yamlls.setup({ + capabilities = capabilities, + settings = { + yaml = { + schemas = { + ["/home/meyer/.config/nvim/clangdschema.json"] = "/.clangd", + }, + }, + }, +}) +require("lspconfig").clangd.setup({ + capabilities = capabilities, + cmd = { + "clangd", + "--header-insertion=iwyu" + } +}) require("lspconfig").pyright.setup({ capabilities = capabilities, }) @@ -48,9 +66,6 @@ require("lspconfig").lua_ls.setup({ }, }) end, - settings = { - Lua = {}, - }, }) local luasnip = require("luasnip") @@ -97,3 +112,4 @@ cmp.setup({ }, }) cmp.event:on("confirm_done", pairs.on_confirm_done()) +require("setupclangdext")