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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 lsp doesn't seem to handle jsx #2221

Closed
1 task done
sigmaSd opened this issue Mar 27, 2024 · 9 comments
Closed
1 task done

馃悰 lsp doesn't seem to handle jsx #2221

sigmaSd opened this issue Mar 27, 2024 · 9 comments
Labels
A-Editors Area: editors A-LSP Area: language server protocol S-Needs response Status: await response from OP

Comments

@sigmaSd
Copy link

sigmaSd commented Mar 27, 2024

Environment information

CLI:
  Version:                      1.6.3
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v20.11.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         unset

Biome Configuration:
  Status:                       unset

Workspace:
  Open Documents:               0

What happened?

function A() {
  return (
    <> // error here
    </>
  );
}

the lsp shows this error, Expected a type but instead found '>'.(parse)
the cli shows no errors

image

Expected result

no error

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@Sec-ant
Copy link
Contributor

Sec-ant commented Mar 27, 2024

What's the filename extension of this file?

@sigmaSd
Copy link
Author

sigmaSd commented Mar 27, 2024

a.jsx

@Sec-ant
Copy link
Contributor

Sec-ant commented Mar 27, 2024

image

I cannot reproduce it but we have a similar report here #2085 (comment)

Is this problem reproducible in a stable way? Can anyone share a repo?

cc @cdvillard

@sigmaSd
Copy link
Author

sigmaSd commented Mar 27, 2024

I'm using helix helix 23.10 (26b3dc29) on fedora 39

@Sec-ant
Copy link
Contributor

Sec-ant commented Mar 27, 2024

This doesn't look to me as an editor-specific issue because it is apparently VSCode in #2085 (comment). Folder structures of the project can be involved in these types of issues. So a reproduction shared as a repo is helpful.

@Sec-ant Sec-ant added S-Needs repro Status: needs a reproduction A-LSP Area: language server protocol labels Mar 27, 2024
@sigmaSd
Copy link
Author

sigmaSd commented Mar 27, 2024

Here is the whole lsp communication in case that helps

hx -> biome

Content-Length: 1810

{"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"general":{"positionEncodings":["utf-8","utf-32","utf-16"]},"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"disabledSupport":true,"isPreferredSupport":true,"resolveSupport":{"properties":["edit","command"]}},"completion":{"completionItem":{"deprecatedSupport":true,"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"snippetSupport":true,"tagSupport":{"valueSet":[1]}},"completionItemKind":{}},"hover":{"contentFormat":["markdown"]},"inlayHint":{"dynamicRegistration":false},"publishDiagnostics":{"versionSupport":true},"rename":{"dynamicRegistration":false,"honorsChangeAnnotations":false,"prepareSupport":true},"signatureHelp":{"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown"],"parameterInformation":{"labelOffsetSupport":true}}}},"window":{"workDoneProgress":true},"workspace":{"applyEdit":true,"configuration":true,"didChangeConfiguration":{"dynamicRegistration":false},"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":false},"executeCommand":{"dynamicRegistration":false},"fileOperations":{"didRename":true,"willRename":true},"inlayHint":{"refreshSupport":false},"symbol":{"dynamicRegistration":false},"workspaceEdit":{"documentChanges":true,"failureHandling":"abort","normalizesLineEndings":false,"resourceOperations":["create","rename","delete"]},"workspaceFolders":true}},"clientInfo":{"name":"helix","version":"23.10 (26b3dc29)"},"processId":21371,"rootPath":"/home/mrcool/dev/deno/lab","rootUri":null,"workspaceFolders":[]},"id":0}Content-Length: 52

{"jsonrpc":"2.0","method":"initialized","params":{}}Content-Length: 226

{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"typescript","text":"function A() {\n  return (\n    <>\n    </>\n  );\n}\n","uri":"file:///home/mrcool/dev/deno/lab/a.jsx","version":0}}}Content-Length: 40

{"jsonrpc":"2.0","result":[null],"id":0}Content-Length: 38

{"jsonrpc":"2.0","result":null,"id":1}Content-Length: 38

{"jsonrpc":"2.0","result":null,"id":2}Content-Length: 44

{"jsonrpc":"2.0","method":"shutdown","id":1}Content-Length: 33

{"jsonrpc":"2.0","method":"exit"}

biome -> hx

Content-Length: 178

{"jsonrpc":"2.0","result":{"capabilities":{"positionEncoding":"utf-8","textDocumentSync":2,"codeActionProvider":true},"serverInfo":{"name":"biome_lsp","version":"1.6.3"}},"id":0}Content-Length: 100

{"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"section":"biome"}]},"id":0}Content-Length: 1315

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/mrcool/dev/deno/lab/a.jsx","diagnostics":[{"range":{"start":{"line":2,"character":5},"end":{"line":2,"character":6}},"severity":1,"code":"parse","source":"biome","message":"Expected a type but instead found '>'.","relatedInformation":[{"location":{"uri":"file:///home/mrcool/dev/deno/lab/a.jsx","range":{"start":{"line":2,"character":5},"end":{"line":2,"character":6}}},"message":""}]},{"range":{"start":{"line":3,"character":5},"end":{"line":3,"character":6}},"severity":1,"code":"parse","source":"biome","message":"Expected a type but instead found '/'.","relatedInformation":[{"location":{"uri":"file:///home/mrcool/dev/deno/lab/a.jsx","range":{"start":{"line":3,"character":5},"end":{"line":3,"character":6}}},"message":""}]},{"range":{"start":{"line":3,"character":7},"end":{"line":3,"character":7}},"severity":1,"code":"parse","source":"biome","message":"unterminated regex literal","relatedInformation":[{"location":{"uri":"file:///home/mrcool/dev/deno/lab/a.jsx","range":{"start":{"line":3,"character":7},"end":{"line":3,"character":7}}},"message":""},{"location":{"uri":"file:///home/mrcool/dev/deno/lab/a.jsx","range":{"start":{"line":3,"character":5},"end":{"line":3,"character":6}}},"message":""}]}],"version":0}}Content-Length: 113

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Server initialized with PID: 21395"}}Content-Length: 533

{"jsonrpc":"2.0","method":"client/unregisterCapability","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"}]},"id":1}Content-Length: 403

{"jsonrpc":"2.0","method":"client/registerCapability","params":{"registrations":[{"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":2}Content-Length: 1315

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/mrcool/dev/deno/lab/a.jsx","diagnostics":[{"range":{"start":{"line":2,"character":5},"end":{"line":2,"character":6}},"severity":1,"code":"parse","source":"biome","message":"Expected a type but instead found '>'.","relatedInformation":[{"location":{"uri":"file:///home/mrcool/dev/deno/lab/a.jsx","range":{"start":{"line":2,"character":5},"end":{"line":2,"character":6}}},"message":""}]},{"range":{"start":{"line":3,"character":5},"end":{"line":3,"character":6}},"severity":1,"code":"parse","source":"biome","message":"Expected a type but instead found '/'.","relatedInformation":[{"location":{"uri":"file:///home/mrcool/dev/deno/lab/a.jsx","range":{"start":{"line":3,"character":5},"end":{"line":3,"character":6}}},"message":""}]},{"range":{"start":{"line":3,"character":7},"end":{"line":3,"character":7}},"severity":1,"code":"parse","source":"biome","message":"unterminated regex literal","relatedInformation":[{"location":{"uri":"file:///home/mrcool/dev/deno/lab/a.jsx","range":{"start":{"line":3,"character":7},"end":{"line":3,"character":7}}},"message":""},{"location":{"uri":"file:///home/mrcool/dev/deno/lab/a.jsx","range":{"start":{"line":3,"character":5},"end":{"line":3,"character":6}}},"message":""}]}],"version":0}}Content-Length: 38

{"jsonrpc":"2.0","result":null,"id":1}

@Sec-ant
Copy link
Contributor

Sec-ant commented Mar 27, 2024

{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"typescript","text":"function A() {\n  return (\n    <>\n    </>\n  );\n}\n","uri":"file:///home/mrcool/dev/deno/lab/a.jsx","version":0}}}Content-Length: 40

In hx -> biome, the param languageId is wrongly labeled as "typescript". Looks like an editor thing?

@ematipico
Copy link
Member

Yeah, it seems helix is sending incorrect information. We use language id as source of truth because it covers cases where users are writing files that aren't saved on the file system yet.

@Sec-ant Sec-ant added A-Editors Area: editors S-Needs response Status: await response from OP and removed S-Needs repro Status: needs a reproduction labels Mar 27, 2024
@sigmaSd
Copy link
Author

sigmaSd commented Mar 27, 2024

Its an issue in my helix on configuration, thanks for your time

@sigmaSd sigmaSd closed this as completed Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Editors Area: editors A-LSP Area: language server protocol S-Needs response Status: await response from OP
Projects
None yet
Development

No branches or pull requests

3 participants