Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting and linting requires CocRestart + saving twice to start working #13

Closed
tony opened this issue Dec 31, 2023 · 14 comments
Closed

Comments

@tony
Copy link
Contributor

tony commented Dec 31, 2023

May be related to #11, but in biome 1.4.0 and vim 9.0.

Workaround (For each vim instance)

Works with #12

  1. Launch vim
  2. Open file, e.g. App.tsx
  3. Run :CocRestart
  4. Save once :w (no formatting yet)
  5. Save a second time :w
  6. Formats correctly
@fannheyward
Copy link
Owner

Try v1.4.1

@tony
Copy link
Contributor Author

tony commented Jan 2, 2024

v1.4.1 still needs me to :CocRestart and save twice for formatting to work.

I think I might need to create an MVP for this, but need more time.

@fannheyward
Copy link
Owner

Can't reproduce, linting and formatting works on saving with w.

Does :CocCommand editor.action.formatDocument work?

@fannheyward
Copy link
Owner

Add "biome.trace.server": "verbose" to coc-settings.json, after w, check :CocCommand workspace.showOutput Biome for the formatting request and response.

@tony
Copy link
Contributor Author

tony commented Jan 2, 2024

Before restart

Output
[Trace - 03:40:11.394] Sending request 'initialize - (0)'.
Params: {
    "processId": 21961,
    "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": "c4cc15a7-d27f-44dc-83ec-df57f33a3d53"
}


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


[Trace - 03:40:11.399] Sending notification 'initialized'.
Params: {}


[Trace - 03:40:11.403] 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 { Results } from \"./Results\";\nimport { Settings } from \"./Settings\";\nimport { TopNav } from \"./TopNav/TopNav\";\nimport { MobxProvider, useMst } from \"./mobx\";\n\nimport \"./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 - 03:40:11.403] Received request 'workspace/configuration - (0)'.
Params: {
    "items": [
        {
            "section": "biome"
        }
    ]
}


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


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


[Trace - 03:40:11.406] Received notification 'window/logMessage'.
Params: {
    "message": "Server initialized with PID: 22408",
    "type": 3
}


[Info  - 03:40:11.406] Server initialized with PID: 22408
[Trace - 03:40:11.406] 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 - 03:40:11.407] Sending response 'client/unregisterCapability - (1)'. Processing request took 1ms
No result returned.


[Trace - 03:40:11.407] 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 - 03:40:11.408] Sending response 'client/registerCapability - (2)'. Processing request took 1ms
No result returned.


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


[Trace - 03:40:19.615] Sending notification 'textDocument/didSave'.
Params: {
    "textDocument": {
        "uri": "file://~/projects/cv/packages/react/src/App.tsx",
        "version": 1
    }
}


[Trace - 03:40:21.181] Sending notification 'textDocument/didSave'.
Params: {
    "textDocument": {
        "uri": "file://~/projects/cv/packages/react/src/App.tsx",
        "version": 1
    }
}


[Trace - 03:40:24.392] Sending notification 'textDocument/didChange'.
Params: {
    "textDocument": {
        "uri": "file://~/projects/cv/packages/react/src/App.tsx",
        "version": 2
    },
    "contentChanges": [
        {
            "range": {
                "start": {
                    "line": 64,
                    "character": 0
                },
                "end": {
                    "line": 65,
                    "character": 0
                }
            },
            "text": "        <Charts />\n        \n",
            "rangeLength": 21
        }
    ]
}


[Trace - 03:40:24.394] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "diagnostics": [],
    "uri": "file://~/projects/cv/packages/react/src/App.tsx",
    "version": 2
}


[Trace - 03:40:24.959] Sending notification 'textDocument/didChange'.
Params: {
    "textDocument": {
        "uri": "file://~/projects/cv/packages/react/src/App.tsx",
        "version": 3
    },
    "contentChanges": [
        {
            "range": {
                "start": {
                    "line": 65,
                    "character": 0
                },
                "end": {
                    "line": 65,
                    "character": 8
                }
            },
            "text": "",
            "rangeLength": 8
        }
    ]
}


[Trace - 03:40:24.960] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "diagnostics": [],
    "uri": "file://~/projects/cv/packages/react/src/App.tsx",
    "version": 3
}


[Trace - 03:40:25.214] Sending notification 'textDocument/didSave'.
Params: {
    "textDocument": {
        "uri": "file://~/projects/cv/packages/react/src/App.tsx",
        "version": 3
    }
}


[Trace - 03:40:26.228] Sending notification 'textDocument/didSave'.
Params: {
    "textDocument": {
        "uri": "file://~/projects/cv/packages/react/src/App.tsx",
        "version": 3
    }
}


[Trace - 03:40:33.226] Sending notification 'textDocument/didClose'.
Params: {
    "textDocument": {
        "uri": "file://~/projects/cv/packages/react/src/App.tsx"
    }
}


[Trace - 03:40:33.226] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "diagnostics": [],
    "uri": "file://~/projects/cv/packages/react/src/App.tsx"
}

No :w / saves would format.

After restart

After I ran CocRestart, I had to run :CocCommand workspace.showOutput Biome again, and formatting ran successfully:

[Trace - 03:44:42.819] Sending notification 'textDocument/didClose'.
Params: {
    "textDocument": {
        "uri": "file://~/projects/cv/packages/react/src/App.tsx"
    }
}


[Trace - 03:44:42.820] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "diagnostics": [],
    "uri": "file://~/projects/cv/packages/react/src/App.tsx"
}


[Trace - 03:45:38.169] Sending request 'textDocument/formatting - (3)'.
Params: {
    "textDocument": {
        "uri": "file://~/projects/cv/packages/react/src/App.tsx"
    },
    "options": {
        "tabSize": 2,
        "insertSpaces": true,
        "insertFinalNewline": true
    }
}


[Trace - 03:45:38.170] Received response 'textDocument/formatting - (3)' in 1ms.
Result: [
    {
        "newText": "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 { Results } from \"./Results\";\nimport { Settings } from \"./Settings\";\nimport { TopNav } from \"./TopNav/TopNav\";\nimport { MobxProvider, useMst } from \"./mobx\";\n\nimport \"./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",
        "range": {
            "end": {
                "character": 0,
                "line": 74
            },
            "start": {
                "character": 0,
                "line": 0
            }
        }
    }
]


[Trace - 03:45:38.220] Sending notification 'textDocument/didSave'.
Params: {
    "textDocument": {
        "uri": "file://~/projects/cv/packages/react/src/App.tsx",
        "version": 4
    }
}

@tony
Copy link
Contributor Author

tony commented Jan 2, 2024 via email

@fannheyward
Copy link
Owner

Still can't reproduce, after w, the textDocument/formatting request is sent and responded.

Tested with your cv project.

@tony
Copy link
Contributor Author

tony commented Jan 2, 2024

Still can't reproduce, after w, the textDocument/formatting request is sent and responded.

Tested with your cv project.

It may be my system, or vim configuration, then.

With :w (:write)

Video
2024-01-02.07-04-43.-.coc-biome.-.coc.restart.mp4

With CocCommand editor.action.formatDocument

This still required :CocRestart

Video
2024-01-02.07-07-28.-.coc-biome.-.formatDocument.mp4

@fannheyward
Copy link
Owner

29.mov

You can set "biome.trace.server": "messages" to simple the trace logs.

@tony
Copy link
Contributor Author

tony commented Jan 7, 2024

@fannheyward It depends on where vim is launched:

  • 👍 Launched vim via project root

    Works immediately

    output:///Biome
    [Trace - 09:17:16.989] Sending request 'initialize - (0)'.
    [Trace - 09:17:16.992] Received response 'initialize - (0)' in 3ms.
    [Trace - 09:17:16.992] Sending notification 'initialized'.
    [Trace - 09:17:16.995] Sending notification 'textDocument/didOpen'.
    [Trace - 09:17:16.996] Received request 'workspace/configuration - (0)'.
    [Trace - 09:17:16.996] Sending response 'workspace/configuration - (0)'. Processing request took 0ms
    [Trace - 09:17:16.998] Received notification 'textDocument/publishDiagnostics'.
    [Trace - 09:17:16.998] Received notification 'window/logMessage'.
    [Info  - 09:17:16.998] Server initialized with PID: 566911
    [Trace - 09:17:16.999] Received request 'client/unregisterCapability - (1)'.
    [Trace - 09:17:16.999] Sending response 'client/unregisterCapability - (1)'. Processing request took 0ms
    [Trace - 09:17:16.999] Received request 'client/registerCapability - (2)'.
    [Trace - 09:17:17.000] Sending response 'client/registerCapability - (2)'. Processing request took 1ms
    [Trace - 09:17:17.002] Received notification 'textDocument/publishDiagnostics'.
    [Trace - 09:17:23.276] Sending notification 'textDocument/didChange'.
    [Trace - 09:17:23.278] Received notification 'textDocument/publishDiagnostics'.
    [Trace - 09:17:23.429] Sending notification 'textDocument/didChange'.
    [Trace - 09:17:23.430] Received notification 'textDocument/publishDiagnostics'.
    [Trace - 09:17:23.594] Sending notification 'textDocument/didChange'.
    [Trace - 09:17:23.596] Received notification 'textDocument/publishDiagnostics'.
    [Trace - 09:17:24.313] Sending request 'textDocument/formatting - (1)'.
    [Trace - 09:17:24.314] Received response 'textDocument/formatting - (1)' in 1ms.
    [Trace - 09:17:24.317] Sending notification 'textDocument/didChange'.
    [Trace - 09:17:24.319] Received notification 'textDocument/publishDiagnostics'.
    [Trace - 09:17:24.379] Sending notification 'textDocument/didSave'.
    [Trace - 09:17:26.736] Sending notification 'textDocument/didChange'.
    [Trace - 09:17:26.738] Received notification 'textDocument/publishDiagnostics'.
    [Trace - 09:17:27.046] Sending notification 'textDocument/didChange'.
    [Trace - 09:17:27.047] Received notification 'textDocument/publishDiagnostics'.
    [Trace - 09:17:27.644] Sending request 'textDocument/formatting - (2)'.
    [Trace - 09:17:27.645] Received response 'textDocument/formatting - (2)' in 1ms.
    [Trace - 09:17:27.647] Sending notification 'textDocument/didChange'.
    [Trace - 09:17:27.650] Received notification 'textDocument/publishDiagnostics'.
    [Trace - 09:17:27.761] Sending notification 'textDocument/didSave'.
    
  • ⚠️ Launched vim via packages/react (mono repo subpackage)

    Requires CocRestart and :w x2 to format

    output:///Biome
    [Trace - 10:17:35.394] Sending request 'initialize - (0)'.
    [Trace - 09:17:35.397] Received response 'initialize - (0)' in 3ms.
    [Trace - 09:17:35.397] Sending notification 'initialized'.
    [Trace - 09:17:35.401] Sending notification 'textDocument/didOpen'.
    [Trace - 09:17:35.402] Received request 'workspace/configuration - (0)'.
    [Trace - 09:17:35.404] Sending response 'workspace/configuration - (0)'. Processing request took 2ms
    [Trace - 09:17:35.406] Received notification 'textDocument/publishDiagnostics'.
    [Trace - 09:17:35.406] Received notification 'window/logMessage'.
    [Info  - 09:17:35.406] Server initialized with PID: 566911
    [Trace - 09:17:35.407] Received request 'client/unregisterCapability - (1)'.
    [Trace - 09:17:35.407] Sending response 'client/unregisterCapability - (1)'. Processing request took 0ms
    [Trace - 09:17:35.407] Received request 'client/registerCapability - (2)'.
    [Trace - 09:17:35.408] Sending response 'client/registerCapability - (2)'. Processing request took 1ms
    [Trace - 09:17:35.410] Received notification 'textDocument/publishDiagnostics'.
    [Trace - 09:17:43.318] Sending notification 'textDocument/didChange'.
    [Trace - 09:17:43.320] Received notification 'textDocument/publishDiagnostics'.
    [Trace - 09:17:43.915] Sending notification 'textDocument/didSave'.
    [Trace - 09:17:45.160] Sending notification 'textDocument/didChange'.
    [Trace - 09:17:45.162] Received notification 'textDocument/publishDiagnostics'.
    [Trace - 09:17:45.530] Sending notification 'textDocument/didChange'.
    [Trace - 09:17:45.532] Received notification 'textDocument/publishDiagnostics'.
    [Trace - 09:17:45.757] Sending notification 'textDocument/didSave'.
    [Trace - 09:17:47.462] Sending notification 'textDocument/didSave'.
    [Trace - 09:17:48.960] Sending notification 'textDocument/didChange'.
    [Trace - 09:17:48.971] Received notification 'textDocument/publishDiagnostics'.
    [Trace - 09:17:49.723] Sending notification 'textDocument/didSave'.
    [Trace - 09:17:54.697] Sending notification 'textDocument/didClose'.
    [Trace - 09:17:54.698] Received notification 'textDocument/publishDiagnostics'.
    

webm:

2024-01-07.09-26-23.-.coc-biome.-.project.root.vs.package.webm
  • :00 - :18: Project root working
  • :18 -end: Project sub-package needing :CocRestart and :w x2

@fannheyward
Copy link
Owner

Launched vim via packages/react

Reproduced. It should be a problem caused by the workspace root detecting. When you're in packages/react folder, coc use this as project root, but there wasn't biome.json file, coc-biome didn't work.

Set "biome.requireConfiguration": false and try again, this won't require must-have biome.json to work

@tony
Copy link
Contributor Author

tony commented Jan 14, 2024

Set "biome.requireConfiguration": false and try again, this won't require must-have biome.json to work

That works, but now the biome.json in the root of the repo isn't used, which is what I'd expect to happen if I ran biome in the shell. CocRestart and :w twice used the project root's biome.json configuration.

2024-01-14.07-52-00.-.coc-biome.-.biome.with.requireConfiguration.mp4

When you're in packages/react folder, coc use this as project root, but there wasn't biome.json file, coc-biome didn't work.

From a technical perspective this makes sense. Is that something to expect for language servers? For coc? coc plugins? Are their exceptions to this?

As a user I'd hope for the behavior to be the same as yarn biome format <file> --write in packages/react/. It would search upwards and use biome.json in the repository root (../../biome.json).

@fannheyward
Copy link
Owner

The key issue is workspace root detecting.

biome.json in the root of the repo isn't used

coc uses packages/react as project root, coc-biome only search biome.json in the root folder.

Why coc uses this as project root? After you open src/App.tsx, coc tried to find project root with root patterns, here's package.json, found and use it.

coc-biome can't search upwards to use biome.json in parent folders.

Why CocRestart works for your expected? Have no idea, I can't reproduce this, CocRestart and :w in packages/react won't use the biome.json in parent root.

@tony
Copy link
Contributor Author

tony commented Apr 6, 2024

@fannheyward Thank you for your help.

I don't see any indication of coc-biome having a bug - I biome will alleviate this via biomejs/biome#2228.

I am closing this, but if there's any disagreement, let me know! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants