Coder Social home page Coder Social logo

coc-biome's Introduction

Hi there ๐Ÿ‘‹

Heyward Fann, aka fannheyward, a developer based in Beijing, China.

coc-biome's People

Contributors

dependabot[bot] avatar fannheyward avatar tony avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

tony

coc-biome's Issues

Monorepo => `No biome.json file found`

When starting nvim at the monorepo root, everything works as expected.

But, if starting nvim in any other directory inside the monorepo, :CocCommand workspace.showOutput logs:

No biome.json file found

Biome's CLI is able to find biome.json no matter in what directory inside the monorepo I run it.

Creates `biome-logs/` and `biome-socket-1.4.1` in each relative directory if no `TMPDIR` envvar set

Mirror of biomejs/biome#306 (comment)

Summary

This happens when no TMPDIR is set.

Debug info

Example codebase

biome logs

Logs: server.log.2023-12-29-13.txt

vim

vim --version
โฏ vim --version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Dec 04 2023 12:42:16)
Included patches: 1-1672, 1729, 1747, 2107, 1840, 1846-1848, 1857-1858, 1873, 1969, 1992, 2010, 2068, 2106, 2108-2112, 2121
Modified by [email protected]
Compiled by [email protected]
Huge version without GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       +tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
-balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +gettext           +num64             +textobjects
-browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     +perl              +title
+channel           +ipv6              +persistent_undo   -toolbar
+cindent           +job               +popupwin          +user_commands
-clientserver      +jumplist          +postscript        +vartabs
-clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3           +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
+cscope            +localmap          +ruby              +wildignore
+cursorbind        +lua               +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con        +mksession         +smartindent       +writebackup
+diff              +modify_fname      +sodium            -X11
+digraphs          +mouse             -sound             -xfontset
-dnd               -mouseshape        +spell             -xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        +mouse_gpm         +statusline        -xsmp
+eval              -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary
-farsi             -mouse_sysmouse    -tag_old_static
   system vimrc file: "/etc/vim/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -ffile-prefix-map=/build/vim-Oyvm4I/vim-9.0.1672=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fdebug-prefix-map=/build/vim-Oyvm4I/vim-9.0.1672=/usr/src/vim-2:9.0.1672-1ubuntu2.2 -DSYS_VIMRC_FILE=\"/etc/vim/vimrc\" -DSYS_GVIMRC_FILE=\"/etc/vim/gvimrc\" -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -Wl,-E -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lselinux -lsodium -lacl -lattr -lgpm -L/usr/lib -llua5.2 -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.36/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python3.11/config-3.11-x86_64-linux-gnu -lpython3.11 -ldl -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lm -lruby-3.1 -lm -L/usr/lib

coc info

CocInfo

## versions

vim version: VIM - Vi IMproved 9.0 9002121
node version: v20.8.0
coc.nvim version: 0.0.82-f82e420 2023-12-18 16:28:32 +0800
coc.nvim directory: ~/.vim/plugged/coc.nvim
term: tmux
platform: linux

## coc.nvim log

2023-12-29T07:20:37.979 INFO (pid:21596) [extension:coc-git] - Looking for git in: git
2023-12-29T07:20:38.001 WARN (pid:21596) [workspace] - Extension "coc-lists" registered synchronized autocmd "VimLeavePre", which could be slow.
2023-12-29T07:20:38.028 INFO (pid:21596) [plugin] - coc.nvim initialized with node: v20.8.0 after 277
2023-12-29T07:20:39.108 INFO (pid:21596) [configurations] - Add folder configuration from file: ~/projects/cv/.vim/coc-settings.json
2023-12-29T07:20:39.178 INFO (pid:21596) [services] - service tsserver started
2023-12-29T07:20:39.484 INFO (pid:21596) [attach] - receive notification: highlight []
2023-12-29T07:20:39.606 INFO (pid:21596) [services] - LanguageClient biome state change: stopped => starting
2023-12-29T07:20:39.711 INFO (pid:21596) [services] - LanguageClient biome state change: starting => running
2023-12-29T07:20:39.716 INFO (pid:21596) [services] - service biome started
2023-12-29T07:20:46.733 INFO (pid:21596) [attach] - receive notification: showInfo []

Biome logs

via :CocCommand workspace.showOutput
[Trace - 07:15:19.959] Sending request 'initialize - (0)'.
Params: {
    "processId": 15799,
    "rootPath": "~/projects/cv",
    "rootUri": "file://~/projects/cv",
    "capabilities": {
        "workspace": {
            "applyEdit": true,
            "workspaceEdit": {
                "documentChanges": true,
                "resourceOperations": [
                    "create",
                    "rename",
                    "delete"
                ],
                "failureHandling": "undo",
                "normalizesLineEndings": true,
                "changeAnnotationSupport": {
                    "groupsOnLabel": false
                }
            },
            "didChangeConfiguration": {
                "dynamicRegistration": true
            },
            "didChangeWatchedFiles": {
                "dynamicRegistration": true,
                "relativePatternSupport": true
            },
            "codeLens": {
                "refreshSupport": true
            },
            "executeCommand": {
                "dynamicRegistration": true
            },
            "configuration": true,
            "fileOperations": {
                "dynamicRegistration": true,
                "didCreate": true,
                "didRename": true,
                "didDelete": true,
                "willCreate": true,
                "willRename": true,
                "willDelete": true
            },
            "semanticTokens": {
                "refreshSupport": true
            },
            "inlayHint": {
                "refreshSupport": true
            },
            "inlineValue": {
                "refreshSupport": true
            },
            "diagnostics": {
                "refreshSupport": true
            },
            "symbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                },
                "tagSupport": {
                    "valueSet": [
                        1
                    ]
                },
                "resolveSupport": {
                    "properties": [
                        "location.range"
                    ]
                }
            },
            "workspaceFolders": true
        },
        "textDocument": {
            "publishDiagnostics": {
                "relatedInformation": true,
                "versionSupport": true,
                "tagSupport": {
                    "valueSet": [
                        1,
                        2
                    ]
                },
                "codeDescriptionSupport": true,
                "dataSupport": true
            },
            "synchronization": {
                "dynamicRegistration": true,
                "willSave": true,
                "willSaveWaitUntil": true,
                "didSave": true
            },
            "completion": {
                "dynamicRegistration": true,
                "contextSupport": true,
                "completionItem": {
                    "snippetSupport": true,
                    "commitCharactersSupport": true,
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "deprecatedSupport": true,
                    "preselectSupport": true,
                    "insertReplaceSupport": true,
                    "tagSupport": {
                        "valueSet": [
                            1
                        ]
                    },
                    "resolveSupport": {
                        "properties": [
                            "documentation",
                            "detail",
                            "additionalTextEdits"
                        ]
                    },
                    "labelDetailsSupport": true,
                    "insertTextModeSupport": {
                        "valueSet": [
                            1,
                            2
                        ]
                    }
                },
                "completionItemKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25
                    ]
                },
                "insertTextMode": 2,
                "completionList": {
                    "itemDefaults": [
                        "commitCharacters",
                        "editRange",
                        "insertTextFormat",
                        "insertTextMode"
                    ]
                }
            },
            "hover": {
                "dynamicRegistration": true,
                "contentFormat": [
                    "markdown",
                    "plaintext"
                ]
            },
            "signatureHelp": {
                "dynamicRegistration": true,
                "contextSupport": true,
                "signatureInformation": {
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "activeParameterSupport": true,
                    "parameterInformation": {
                        "labelOffsetSupport": true
                    }
                }
            },
            "references": {
                "dynamicRegistration": true
            },
            "definition": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "documentHighlight": {
                "dynamicRegistration": true
            },
            "documentSymbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                },
                "hierarchicalDocumentSymbolSupport": true,
                "tagSupport": {
                    "valueSet": [
                        1
                    ]
                },
                "labelSupport": true
            },
            "codeAction": {
                "dynamicRegistration": true,
                "isPreferredSupport": true,
                "disabledSupport": true,
                "dataSupport": true,
                "honorsChangeAnnotations": false,
                "resolveSupport": {
                    "properties": [
                        "edit"
                    ]
                },
                "codeActionLiteralSupport": {
                    "codeActionKind": {
                        "valueSet": [
                            "",
                            "quickfix",
                            "refactor",
                            "refactor.extract",
                            "refactor.inline",
                            "refactor.rewrite",
                            "source",
                            "source.organizeImports"
                        ]
                    }
                }
            },
            "codeLens": {
                "dynamicRegistration": true
            },
            "formatting": {
                "dynamicRegistration": true
            },
            "rangeFormatting": {
                "dynamicRegistration": true
            },
            "onTypeFormatting": {
                "dynamicRegistration": true
            },
            "rename": {
                "dynamicRegistration": true,
                "prepareSupport": true,
                "honorsChangeAnnotations": true,
                "prepareSupportDefaultBehavior": 1
            },
            "documentLink": {
                "dynamicRegistration": true,
                "tooltipSupport": true
            },
            "typeDefinition": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "implementation": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "declaration": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "colorProvider": {
                "dynamicRegistration": true
            },
            "foldingRange": {
                "dynamicRegistration": true,
                "rangeLimit": 5000,
                "lineFoldingOnly": true,
                "foldingRangeKind": {
                    "valueSet": [
                        "comment",
                        "imports",
                        "region"
                    ]
                },
                "foldingRange": {
                    "collapsedText": false
                }
            },
            "selectionRange": {
                "dynamicRegistration": true
            },
            "callHierarchy": {
                "dynamicRegistration": true
            },
            "linkedEditingRange": {
                "dynamicRegistration": true
            },
            "semanticTokens": {
                "dynamicRegistration": true,
                "tokenTypes": [
                    "namespace",
                    "type",
                    "class",
                    "enum",
                    "interface",
                    "struct",
                    "typeParameter",
                    "parameter",
                    "variable",
                    "property",
                    "enumMember",
                    "event",
                    "function",
                    "method",
                    "macro",
                    "keyword",
                    "modifier",
                    "comment",
                    "string",
                    "number",
                    "regexp",
                    "decorator",
                    "operator"
                ],
                "tokenModifiers": [
                    "declaration",
                    "definition",
                    "readonly",
                    "static",
                    "deprecated",
                    "abstract",
                    "async",
                    "modification",
                    "documentation",
                    "defaultLibrary"
                ],
                "formats": [
                    "relative"
                ],
                "requests": {
                    "range": true,
                    "full": {
                        "delta": true
                    }
                },
                "multilineTokenSupport": false,
                "overlappingTokenSupport": false,
                "serverCancelSupport": true,
                "augmentsSyntaxTokens": true
            },
            "inlayHint": {
                "dynamicRegistration": true,
                "resolveSupport": {
                    "properties": [
                        "tooltip",
                        "textEdits",
                        "label.tooltip",
                        "label.location",
                        "label.command"
                    ]
                }
            },
            "inlineValue": {
                "dynamicRegistration": true
            },
            "diagnostic": {
                "dynamicRegistration": true,
                "relatedDocumentSupport": true
            },
            "typeHierarchy": {
                "dynamicRegistration": true
            }
        },
        "window": {
            "showMessage": {
                "messageActionItem": {
                    "additionalPropertiesSupport": true
                }
            },
            "showDocument": {
                "support": true
            },
            "workDoneProgress": true
        },
        "general": {
            "regularExpressions": {
                "engine": "ECMAScript",
                "version": "ES2020"
            },
            "markdown": {
                "parser": "marked",
                "version": "4.0.10"
            },
            "positionEncodings": [
                "utf-16"
            ],
            "staleRequestSupport": {
                "cancel": true,
                "retryOnContentModified": [
                    "textDocument/inlayHint",
                    "textDocument/semanticTokens/full",
                    "textDocument/semanticTokens/range",
                    "textDocument/semanticTokens/full/delta"
                ]
            }
        }
    },
    "trace": "verbose",
    "workspaceFolders": [
        {
            "uri": "file://~/projects/cv",
            "name": "cv"
        }
    ],
    "locale": "C",
    "clientInfo": {
        "name": "coc.nvim",
        "version": "0.0.82"
    },
    "workDoneToken": "a8fb554d-fa7b-49e0-8a26-27777910880d"
}


[Trace - 07:15:19.966] Received response 'initialize - (0)' in 7ms.
Result: {
    "capabilities": {
        "codeActionProvider": true,
        "positionEncoding": "utf-16",
        "textDocumentSync": 2
    },
    "serverInfo": {
        "name": "biome_lsp",
        "version": "1.4.1"
    }
}


[Trace - 07:15:19.967] Sending notification 'initialized'.
Params: {}


[Trace - 07:15:19.970] Sending notification 'textDocument/didOpen'.
Params: {
    "textDocument": {
        "uri": "file://~/projects/cv/packages/react/src/App.tsx",
        "languageId": "typescriptreact",
        "version": 1,
        "text": "import React from \"react\";\n\nimport { observer } from \"mobx-react-lite\";\n\nimport * as mobxLib from \"@tony/cv-lib/search/mobx\";\n\nimport { Charts } from \"./Charts\";\nimport { MobxProvider, useMst } from \"./mobx\";\nimport { Results } from \"./Results\";\nimport { Settings } from \"./Settings\";\nimport { TopNav } from \"./TopNav/TopNav\";\n\nimport \"@tony/cv-ui/styles/style.css\";\n\nconst { state: cvState } = mobxLib;\n\nconst AppContainer: React.FC<{ children: React.ReactNode }> = ({\n  children,\n}) => {\n  return (\n    <div>\n      <MobxProvider value={cvState}>\n        <TopNav />\n        {children}\n      </MobxProvider>\n    </div>\n  );\n};\n\nexport interface CVDominantLanguageCSS extends React.CSSProperties {\n  \"--cv-dominant-language-color\": React.CSSProperties[\"color\"];\n  \"--cv-dominant-language-background\": React.CSSProperties[\"backgroundColor\"];\n}\n\nconst DominantLanguageCSSVariable: React.FC = observer(() => {\n  const cvState = useMst();\n  const dominantLanguage = cvState.dominantLanguage;\n\n  return dominantLanguage ? (\n    <style\n      // biome-ignore lint/security/noDangerouslySetInnerHtml: Simplest way with JSX?\n      dangerouslySetInnerHTML={{\n        __html: `\n  :root {\n    --cv-dominant-language-color: ${dominantLanguage.ui.color};\n    --cv-dominant-language-background: ${dominantLanguage.ui.backgroundColor};\n  }\n  `,\n      }}\n    />\n  ) : null;\n});\n\nconst App: React.FC = observer(() => {\n  // window.cvState = cvState;\n\n  return (\n    <AppContainer>\n      {cvState.ui.isLoading ? (\n        <div id=\"loading-screen\">Loading CV Data</div>\n      ) : (\n        <>\n          <DominantLanguageCSSVariable />\n          <Settings />\n          <Charts />\n          <Results />\n        </>\n      )}\n    </AppContainer>\n  );\n});\n\nexport default App;\n"
    }
}


[Trace - 07:15:19.971] Received request 'workspace/configuration - (0)'.
Params: {
    "items": [
        {
            "section": "biome"
        }
    ]
}


[Trace - 07:15:19.972] Sending response 'workspace/configuration - (0)'. Processing request took 1ms
Result: [
    {
        "enable": true,
        "bin": null,
        "requireConfiguration": true,
        "trace": {
            "server": "verbose"
        }
    }
]


[Trace - 07:15:19.974] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "diagnostics": [],
    "uri": "file://~/projects/cv/packages/react/src/App.tsx",
    "version": 1
}


[Trace - 07:15:19.974] Received notification 'window/logMessage'.
Params: {
    "message": "Server initialized with PID: 16274",
    "type": 3
}


[Info  - 07:15:19.974] Server initialized with PID: 16274
[Trace - 07:15:19.974] Received request 'client/unregisterCapability - (1)'.
Params: {
    "unregisterations": [
        {
            "id": "biome_did_change_extension_settings",
            "method": "workspace/didChangeConfiguration"
        },
        {
            "id": "biome_range_formatting",
            "method": "textDocument/rangeFormatting"
        },
        {
            "id": "biome_on_type_formatting",
            "method": "textDocument/onTypeFormatting"
        },
        {
            "id": "biome_rename",
            "method": "textDocument/rename"
        },
        {
            "id": "biome_formatting",
            "method": "textDocument/formatting"
        },
        {
            "id": "biome_did_change_workspace_settings",
            "method": "workspace/didChangeWatchedFiles"
        }
    ]
}


[Trace - 07:15:19.975] Sending response 'client/unregisterCapability - (1)'. Processing request took 0ms
No result returned.


[Trace - 07:15:19.975] Received request 'client/registerCapability - (2)'.
Params: {
    "registrations": [
        {
            "id": "biome_did_change_extension_settings",
            "method": "workspace/didChangeConfiguration"
        },
        {
            "id": "biome_range_formatting",
            "method": "textDocument/rangeFormatting"
        },
        {
            "id": "biome_on_type_formatting",
            "method": "textDocument/onTypeFormatting",
            "registerOptions": {
                "documentSelector": null,
                "firstTriggerCharacter": "}",
                "moreTriggerCharacter": [
                    "]",
                    ")"
                ]
            }
        },
        {
            "id": "biome_formatting",
            "method": "textDocument/formatting"
        },
        {
            "id": "biome_did_change_workspace_settings",
            "method": "workspace/didChangeWatchedFiles",
            "registerOptions": {
                "watchers": [
                    {
                        "globPattern": "~/projects/cv/biome.json",
                        "kind": 7
                    },
                    {
                        "globPattern": "~/projects/cv/rome.json",
                        "kind": 7
                    }
                ]
            }
        }
    ]
}


[Trace - 07:15:19.976] Sending response 'client/registerCapability - (2)'. Processing request took 1ms
No result returned.


[Trace - 07:15:19.977] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "diagnostics": [],
    "uri": "file://~/projects/cv/packages/react/src/App.tsx",
    "version": 1
}


[Trace - 07:15:58.242] Sending notification 'textDocument/didOpen'.
Params: {
    "textDocument": {
        "uri": "file://~/projects/cv/packages/react/src/TopNav/TopNav.tsx",
        "languageId": "typescriptreact",
        "version": 1,
        "text": "import React from \"react\";\n\nimport \"./TopNav.css\";\n\nimport { ColorSchemeToggle } from \"./ColorScheme\";\n\nexport const TopNav: React.FC = () => (\n  <nav id=\"top-nav\">\n    <div className=\"top-nav--container\">\n      <div className=\"site-info\" title=\"Tony Narlock's CV\">\n        <div className=\"site-info--logo\">\n          <div className=\"site-info--logo--img\">&nbsp;</div>\n        </div>\n        <div className=\"site-info--site-name\">Tony Narlock&apos;s CV</div>\n        <div className=\"site-info--filler\">&nbsp;</div>\n        <div className=\"site-info--color-scheme-toggle--container\">\n          <ColorSchemeToggle />\n        </div>\n      </div>\n    </div>\n  </nav>\n);\n"
    }
}


[Trace - 07:15:58.251] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "diagnostics": [],
    "uri": "file://~/projects/cv/packages/react/src/TopNav/TopNav.tsx",
    "version": 1
}


[Trace - 07:16:01.305] Sending notification 'textDocument/didSave'.
Params: {
    "textDocument": {
        "uri": "file://~/projects/cv/packages/react/src/TopNav/TopNav.tsx",
        "version": 1
    }
}


[Trace - 07:16:07.746] Sending notification 'textDocument/didOpen'.
Params: {
    "textDocument": {
        "uri": "file://~/projects/cv/.vim/coc-settings.json",
        "languageId": "json",
        "version": 1,
        "text": "{\n  \"[markdown][javascript][typescript][typescriptreact]\": {\n    \"coc.preferences.formatOnSave\": true\n  },\n  \"prettier.enable\": false,\n  \"eslint.enable\": false,\n  \"biome.enable\": true\n}\n"
    }
}


[Trace - 07:16:07.753] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "diagnostics": [],
    "uri": "file://~/projects/cv/.vim/coc-settings.json",
    "version": 1
}

Recreation steps

  1. Clone https://github.com/tony/cv
  2. yarn
  3. Open App.tsx with coc-biome enabled
  4. biome-socket-1.4.1 and biome-logs/ are automatically created

Cannot format json/jsonc files

Context

I've install coc-biome, coc-prettier and coc-json .

I'm using "prettier.formatterPriority": -1 in my coc-settings.json to prioritize coc-biome's formatter.

{
  "coc.preferences.formatOnSave": true,
  "colors.enable": true,
  "refactor.saveToFile": true,
  "tsserver.log": "verbose",
  "languageserver": {
    "elmLS": {
      "command": "elm-language-server",
      "filetypes": ["elm"],
      "rootPatterns": ["elm.json"]
    },
    "ocamllsp": {
      "command": "ocamllsp",
      "rootPatterns": ["dune-project"],
      "filetypes": ["ocaml"]
    },
    "ccls": {
      "command": "ccls",
      "filetypes": ["c", "cpp", "objc", "objcpp"],
      "rootPatterns": [".ccls", "compile_commands.json", ".git"],
      "initializationOptions": {
        "cache": {
          "directory": "/tmp/ccls"
        }
      }
    }
  },
  "toml.schema.associations": {
    ".*/Cargo\\.toml": "https://json.schemastore.org/cargo.json"
  },
  "prettier.formatterPriority": -1,
  "Lua": {
    "diagnostics": {
      "globals": ["vim"]
    }
  },
  "java": {
    "jdt.ls.java.home": "/usr/lib/jvm/java-20-openjdk",
    "import.gradle.java.home": "/usr/lib/jvm/java-20-openjdk"
  },
  "rust-analyzer": {
    "updates.channel": "nightly",
    "cargo.allFeatures": true
  },
  "diagnostic.virtualText": true,
  "codeLens.position": "eol",
  // If you use neovim you can enable codelenses with this
  "codeLens.enable": true
}

Problem

Format on save works properly on TypeScript files. But JSON/JSONC files (e.g. tsconfig.json) aren't formatted with biome. Some other formatter (probably from coc-prettier, or coc-json idk) is used to format JSON files on save.

Also, execute biome check --write in command-line does format JSON files.

It seems coc-biome does not started for JSON files:

(Output of :CocInfo on tsconfig.json)
## versions

vim version: NVIM v0.10.0
node version: v21.1.0
coc.nvim version: 0.0.82-c3ae5c3b 2024-05-23 20:39:40 +0800
coc.nvim directory: /Users/takagiy/.local/share/nvim/site/pack/packer/start/coc.nvim
term: alacritty
platform: darwin

## Log of coc.nvim

2024-06-30T14:50:14.676 INFO (pid:10861) [plugin] - coc.nvim initialized with node: v21.1.0 after 153
2024-06-30T14:50:14.676 INFO (pid:10861) [services] - LanguageClient Json language server state change: stopped => starting
2024-06-30T14:50:14.681 INFO (pid:10861) [language-client-index] - Language server "json" started with 10864
2024-06-30T14:50:14.733 INFO (pid:10861) [services] - LanguageClient Json language server state change: starting => running
2024-06-30T14:50:14.737 INFO (pid:10861) [services] - service json started

I've tried instruction in this to enable coc-biome for JSON files but it doesn't work.

Notes

  • NoeVim: 0.10.0
  • Coc: 0.0.82-c3ae5c3b
  • coc-biome: 1.6.0

biome.json:

{
  "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
  "organizeImports": {
    "enabled": true
  },
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true
    }
  },
  "formatter": {
    "enabled": true,
    "formatWithErrors": true,
    "indentStyle": "space"
  },
  "vcs": {
    "enabled": true,
    "clientKind": "git",
    "useIgnoreFile": true
  }
}

init.lua:

  require('packer').startup({
  function(use)
...
    use {
      'neoclide/coc.nvim',
      branch = 'release',
      config = function()
        vim.g.coc_global_extensions = {
          'coc-rust-analyzer',
          'coc-toml',
          'coc-json',
          'coc-tsserver',
          'coc-prettier',
          'coc-biome',
          'coc-highlight',
          'coc-lua',
          'coc-stylua',
          'coc-java',
        }
        local function check_back_space()
          local col = vim.fn.col('.') - 1
          return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil
        end
        local opts = { silent = true, noremap = true, expr = true, replace_keycodes = false }
        vim.keymap.set("i", "<Tab>",
          function()
            if vim.fn['coc#pum#visible']() == 1 then
              return vim.fn['coc#pum#next'](1)
            end
            if check_back_space() then
              return vim.fn['coc#refresh']()
            end
            return "<Tab>"
          end
          , opts)
        vim.keymap.set("i", "<CR>", function()
          if vim.fn['coc#pum#visible']() == 1 then
            return vim.fn['coc#pum#confirm']();
          end
          return "\r"
        end, opts)
        vim.g.mapleader = " "
        vim.keymap.set("n", "<leader>rn", "<Plug>(coc-rename)", { silent = true })
        vim.keymap.set("n", "<leader>ac", "<Plug>(coc-codeaction-cursor)", { silent = true })
      end
    }
...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.