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

LSP error in Relay GraphQL VSCode Extension #3975

Open
alex-statsig opened this issue Jun 13, 2022 · 38 comments
Open

LSP error in Relay GraphQL VSCode Extension #3975

alex-statsig opened this issue Jun 13, 2022 · 38 comments

Comments

@alex-statsig
Copy link
Contributor

alex-statsig commented Jun 13, 2022

Updated to relay 14 and added the Relay GraphQL extension for VSCode. Upon trying to use features like Intellisense on hover, I see some errors logged to "Relay LSP Logs" output:

[DEBUG] request received Request { id: RequestId(I32(194)), method: "textDocument/hover", params: Object({"position": Object({"character": Number(11), "line": Number(20)}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/ScheduledRollupsDialog.tsx")})}) }
[DEBUG] lsp_method: textDocument/hover
[DEBUG] lsp_type: request
[DEBUG] Successfully parsed the definitions for a target GraphQL source
[DEBUG] position_span: 155:155
lsp_outcome: error
[DEBUG] lsp_error_message: get_schema: schema is missing (or not ready, yet) for the `default` project.
[DEBUG]    0ms lsp_message_processing_time

I assume my relay config must be set up correctly since relay-compiler works fine. My project is looked at ./console/, but I've added that root to the extension settings (until I did that I saw a different error about not finding a project).

The "Relay" output includes:

Searching for the relay-compiler starting at: /Users/alex/dev/statsig/console
Starting the Relay GraphQL extension...
Using relay binary: /Users/alex/dev/statsig/console/node_modules/relay-compiler/macos-arm64/relay
Starting the Relay Langauge Server with these options: {"options":{"cwd":"/Users/alex/dev/statsig/console"},"command":"/Users/alex/dev/statsig/console/node_modules/relay-compiler/macos-arm64/relay","args":["lsp","--output=debug"]}
Not starting the Relay Compiler. Please enable relay.autoStartCompiler in your settings if you want the compiler to start when you open your project.
@captbaritone
Copy link
Contributor

Thanks for the bug report @alex-statsig. Do you have any output logs before that? I'm particularly interested in output from when the LSP first starts.

Could you clarify exactly which extension settings you have set?

@alex-statsig
Copy link
Contributor Author

The "Relay" output included above is the full output for that channel.

Here's the full output from "Relay LSP Logs":

[DEBUG] Initialized stdio transport layer
[DEBUG] < {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":52943,"clientInfo":{"name":"Visual Studio Code - Insiders","version":"1.68.0-insider"},"locale":"en-us","rootPath":"/Users/alex/dev/statsig","rootUri":"file:///Users/alex/dev/statsig","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional","normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":true}},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":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]}},"codeLens":{"refreshSupport":true},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true,"semanticTokens":{"refreshSupport":true},"fileOperations":{"dynamicRegistration":true,"didCreate":true,"didRename":true,"didDelete":true,"willCreate":true,"willRename":true,"willDelete":true}},"textDocument":{"publishDiagnostics":{"relatedInformation":true,"versionSupport":false,"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,"tagSupport":{"valueSet":[1]},"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"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]}},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true},"activeParameterSupport":true},"contextSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"references":{"dynamicRegistration":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,"resolveSupport":{"properties":["edit"]},"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"honorsChangeAnnotations":false},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true,"prepareSupportDefaultBehavior":1,"honorsChangeAnnotations":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true},"declaration":{"dynamicRegistration":true,"linkSupport":true},"selectionRange":{"dynamicRegistration":true},"callHierarchy":{"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","operator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"formats":["relative"],"requests":{"range":true,"full":{"delta":true}},"multilineTokenSupport":false,"overlappingTokenSupport":false},"linkedEditingRange":{"dynamicRegistration":true}},"window":{"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}},"showDocument":{"support":true},"workDoneProgress":true},"general":{"regularExpressions":{"engine":"ECMAScript","version":"ES2020"},"markdown":{"parser":"marked","version":"1.1.0"}}},"trace":"off","workspaceFolders":[{"uri":"file:///Users/alex/dev/statsig","name":"statsig"}]}}
[DEBUG] > {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"codeActionProvider":true,"completionProvider":{"resolveProvider":true,"triggerCharacters":["(","\n",",","@"]},"definitionProvider":true,"hoverProvider":true,"referencesProvider":true,"textDocumentSync":1}}}
[DEBUG] < {"jsonrpc":"2.0","method":"initialized","params":{}}
[DEBUG] < {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts","languageId":"typescript","version":1,"text":"(redacted file with a graphql mutation)"}}}
[DEBUG] JSON-RPC handshake completed
[DEBUG] Running language server with config root "/Users/alex/dev/statsig/console"
[DEBUG] Creating lsp_state...
[DEBUG] Creating lsp_state created!
[DEBUG] Processing task "InboundMessage(Notification(Notification { method: \"textDocument/didOpen\", params: Object({\"textDocument\": Object({\"languageId\": String(\"typescript\"), \"text\": String(\"(redacted file with a graphql mutation)\"), \"uri\": String(\"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts\"), \"version\": Number(1)})}) }))"
[DEBUG] notification received Notification { method: "textDocument/didOpen", params: Object({"textDocument": Object({"languageId": String("typescript"), "text": String("(redacted file with a graphql mutation)"), "uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts"), "version": Number(1)})}) }
[DEBUG] lsp_method: textDocument/didOpen
[DEBUG] lsp_type: notification
[DEBUG] lsp_outcome: success
[DEBUG]    0ms lsp_message_processing_time
[DEBUG] task InboundMessage(Notification(Notification { method: "textDocument/didOpen", params: Object({"textDocument": Object({"languageId": String("typescript"), "text": String("(redacted file with a graphql mutation)"), "uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts"), "version": Number(1)})}) })) completed in 0ms
[DEBUG] Initializing resources for LSP server
[DEBUG] > {"jsonrpc":"2.0","id":"window/showStatus","method":"window/showStatus","params":{"message":"Sending watchman query to get source files and possible saved state","shortMessage":"Relay: watchman...","type":2}}
[DEBUG] < {"jsonrpc":"2.0","id":"window/showStatus","result":null}
[DEBUG] error: Watchman error: While invoking the watchman CLI to discover the server connection details: No such file or directory (os error 2), stderr=``
[DEBUG] Initializing resources for LSP server
[DEBUG] > {"jsonrpc":"2.0","id":"window/showStatus","method":"window/showStatus","params":{"message":"Sending watchman query to get source files and possible saved state","shortMessage":"Relay: watchman...","type":2}}
[DEBUG] Processing task "LSPState(ValidateSyncedSource(Url { scheme: \"file\", cannot_be_a_base: false, username: \"\", password: None, host: None, port: None, path: \"/Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts\", query: None, fragment: None }))"
[DEBUG] Processing task "InboundMessage(Response(Response { id: RequestId(String(\"window/showStatus\")), result: None, error: None }))"
[DEBUG] task LSPState(ValidateSyncedSource(Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts", query: None, fragment: None })) completed in 1ms
[DEBUG] < {"jsonrpc":"2.0","id":"window/showStatus","result":null}
[DEBUG] task InboundMessage(Response(Response { id: RequestId(String("window/showStatus")), result: None, error: None })) completed in 1ms
[DEBUG] Processing task "InboundMessage(Response(Response { id: RequestId(String(\"window/showStatus\")), result: None, error: None }))"
[DEBUG] task InboundMessage(Response(Response { id: RequestId(String("window/showStatus")), result: None, error: None })) completed in 0ms
[DEBUG] error: Watchman error: While invoking the watchman CLI to discover the server connection details: No such file or directory (os error 2), stderr=``
[DEBUG] Initializing resources for LSP server
[DEBUG] > {"jsonrpc":"2.0","id":"window/showStatus","method":"window/showStatus","params":{"message":"Sending watchman query to get source files and possible saved state","shortMessage":"Relay: watchman...","type":2}}
[DEBUG] error: Watchman error: While invoking the watchman CLI to discover the server connection details: No such file or directory (os error 2), stderr=``
thread 'tokio-runtime-worker' panicked at 'Watchman error: While invoking the watchman CLI to discover the server connection details: No such file or directory (os error 2), stderr=``', /Users/runner/work/relay/relay/compiler/crates/relay-lsp/src/server/lsp_state_resources.rs:90:25
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[DEBUG] < {"jsonrpc":"2.0","id":"window/showStatus","result":null}
[DEBUG] Processing task "InboundMessage(Response(Response { id: RequestId(String(\"window/showStatus\")), result: None, error: None }))"
[DEBUG] task InboundMessage(Response(Response { id: RequestId(String("window/showStatus")), result: None, error: None })) completed in 0ms
[DEBUG] < {"jsonrpc":"2.0","id":1,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts"},"range":{"start":{"line":100,"character":18},"end":{"line":100,"character":18}},"context":{"diagnostics":[]}}}
[DEBUG] Processing task "InboundMessage(Request(Request { id: RequestId(I32(1)), method: \"textDocument/codeAction\", params: Object({\"context\": Object({\"diagnostics\": Array([])}), \"range\": Object({\"end\": Object({\"character\": Number(18), \"line\": Number(100)}), \"start\": Object({\"character\": Number(18), \"line\": Number(100)})}), \"textDocument\": Object({\"uri\": String(\"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts\")})}) }))"
[DEBUG] request received Request { id: RequestId(I32(1)), method: "textDocument/codeAction", params: Object({"context": Object({"diagnostics": Array([])}), "range": Object({"end": Object({"character": Number(18), "line": Number(100)}), "start": Object({"character": Number(18), "line": Number(100)})}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) }
[DEBUG] lsp_method: textDocument/codeAction
[DEBUG] lsp_type: request
[DEBUG] lsp_outcome: error
[DEBUG] lsp_error_message: Request Canceled
[DEBUG]    0ms lsp_message_processing_time
[DEBUG] task InboundMessage(Request(Request { id: RequestId(I32(1)), method: "textDocument/codeAction", params: Object({"context": Object({"diagnostics": Array([])}), "range": Object({"end": Object({"character": Number(18), "line": Number(100)}), "start": Object({"character": Number(18), "line": Number(100)})}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) })) completed in 0ms
[DEBUG] > {"jsonrpc":"2.0","id":1,"error":{"code":-32001,"message":"Request Canceled"}}
[Error - 1:34:50 PM] Request textDocument/codeAction failed.
  Message: Request Canceled
  Code: -32001 
[DEBUG] < {"jsonrpc":"2.0","id":2,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts"},"range":{"start":{"line":100,"character":18},"end":{"line":100,"character":18}},"context":{"diagnostics":[]}}}
[DEBUG] Processing task "InboundMessage(Request(Request { id: RequestId(I32(2)), method: \"textDocument/codeAction\", params: Object({\"context\": Object({\"diagnostics\": Array([])}), \"range\": Object({\"end\": Object({\"character\": Number(18), \"line\": Number(100)}), \"start\": Object({\"character\": Number(18), \"line\": Number(100)})}), \"textDocument\": Object({\"uri\": String(\"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts\")})}) }))"
[DEBUG] request received Request { id: RequestId(I32(2)), method: "textDocument/codeAction", params: Object({"context": Object({"diagnostics": Array([])}), "range": Object({"end": Object({"character": Number(18), "line": Number(100)}), "start": Object({"character": Number(18), "line": Number(100)})}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) }
[DEBUG] lsp_method: textDocument/codeAction
[DEBUG] lsp_type: request
[DEBUG] lsp_outcome: error
[DEBUG] lsp_error_message: Request Canceled
[DEBUG]    0ms lsp_message_processing_time
[DEBUG] task InboundMessage(Request(Request { id: RequestId(I32(2)), method: "textDocument/codeAction", params: Object({"context": Object({"diagnostics": Array([])}), "range": Object({"end": Object({"character": Number(18), "line": Number(100)}), "start": Object({"character": Number(18), "line": Number(100)})}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) })) completed in 0ms
[DEBUG] > {"jsonrpc":"2.0","id":2,"error":{"code":-32001,"message":"Request Canceled"}}
[Error - 1:34:51 PM] Request textDocument/codeAction failed.
  Message: Request Canceled
  Code: -32001 
[DEBUG] < {"jsonrpc":"2.0","id":3,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts"},"range":{"start":{"line":100,"character":18},"end":{"line":100,"character":18}},"context":{"diagnostics":[]}}}
[DEBUG] Processing task "InboundMessage(Request(Request { id: RequestId(I32(3)), method: \"textDocument/codeAction\", params: Object({\"context\": Object({\"diagnostics\": Array([])}), \"range\": Object({\"end\": Object({\"character\": Number(18), \"line\": Number(100)}), \"start\": Object({\"character\": Number(18), \"line\": Number(100)})}), \"textDocument\": Object({\"uri\": String(\"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts\")})}) }))"
[DEBUG] request received Request { id: RequestId(I32(3)), method: "textDocument/codeAction", params: Object({"context": Object({"diagnostics": Array([])}), "range": Object({"end": Object({"character": Number(18), "line": Number(100)}), "start": Object({"character": Number(18), "line": Number(100)})}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) }
[DEBUG] lsp_method: textDocument/codeAction
[DEBUG] lsp_type: request
[DEBUG] lsp_outcome: error
[DEBUG] lsp_error_message: Request Canceled
[DEBUG]    0ms lsp_message_processing_time
[DEBUG] task InboundMessage(Request(Request { id: RequestId(I32(3)), method: "textDocument/codeAction", params: Object({"context": Object({"diagnostics": Array([])}), "range": Object({"end": Object({"character": Number(18), "line": Number(100)}), "start": Object({"character": Number(18), "line": Number(100)})}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) })) completed in 0ms
[DEBUG] > {"jsonrpc":"2.0","id":3,"error":{"code":-32001,"message":"Request Canceled"}}
[Error - 1:34:51 PM] Request textDocument/codeAction failed.
  Message: Request Canceled
  Code: -32001 
[DEBUG] < {"jsonrpc":"2.0","id":4,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts"},"range":{"start":{"line":100,"character":18},"end":{"line":100,"character":18}},"context":{"diagnostics":[]}}}
[DEBUG] Processing task "InboundMessage(Request(Request { id: RequestId(I32(4)), method: \"textDocument/codeAction\", params: Object({\"context\": Object({\"diagnostics\": Array([])}), \"range\": Object({\"end\": Object({\"character\": Number(18), \"line\": Number(100)}), \"start\": Object({\"character\": Number(18), \"line\": Number(100)})}), \"textDocument\": Object({\"uri\": String(\"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts\")})}) }))"
[DEBUG] request received Request { id: RequestId(I32(4)), method: "textDocument/codeAction", params: Object({"context": Object({"diagnostics": Array([])}), "range": Object({"end": Object({"character": Number(18), "line": Number(100)}), "start": Object({"character": Number(18), "line": Number(100)})}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) }
[DEBUG] lsp_method: textDocument/codeAction
[DEBUG] lsp_type: request
[DEBUG] lsp_outcome: error
[DEBUG] lsp_error_message: Request Canceled
[DEBUG]    0ms lsp_message_processing_time
[DEBUG] task InboundMessage(Request(Request { id: RequestId(I32(4)), method: "textDocument/codeAction", params: Object({"context": Object({"diagnostics": Array([])}), "range": Object({"end": Object({"character": Number(18), "line": Number(100)}), "start": Object({"character": Number(18), "line": Number(100)})}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) })) completed in 0ms
[DEBUG] > {"jsonrpc":"2.0","id":4,"error":{"code":-32001,"message":"Request Canceled"}}
[Error - 1:34:51 PM] Request textDocument/codeAction failed.
  Message: Request Canceled
  Code: -32001 
[DEBUG] < {"jsonrpc":"2.0","id":5,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts"},"position":{"line":24,"character":5}}}
[DEBUG] Processing task "InboundMessage(Request(Request { id: RequestId(I32(5)), method: \"textDocument/hover\", params: Object({\"position\": Object({\"character\": Number(5), \"line\": Number(24)}), \"textDocument\": Object({\"uri\": String(\"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts\")})}) }))"
[DEBUG] request received Request { id: RequestId(I32(5)), method: "textDocument/hover", params: Object({"position": Object({"character": Number(5), "line": Number(24)}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) }
[DEBUG] lsp_method: textDocument/hover
[DEBUG] lsp_type: request
[DEBUG] Successfully parsed the definitions for a target GraphQL source
[DEBUG] position_span: 378:378
[DEBUG] lsp_outcome: error
[DEBUG] lsp_error_message: get_schema: schema is missing (or not ready, yet) for the `default` project.
[DEBUG]    0ms lsp_message_processing_time
[DEBUG] task InboundMessage(Request(Request { id: RequestId(I32(5)), method: "textDocument/hover", params: Object({"position": Object({"character": Number(5), "line": Number(24)}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) })) completed in 0ms
[DEBUG] > {"jsonrpc":"2.0","id":5,"error":{"code":-32001,"message":"get_schema: schema is missing (or not ready, yet) for the `default` project."}}
[Error - 1:34:52 PM] Request textDocument/hover failed.
  Message: get_schema: schema is missing (or not ready, yet) for the `default` project.
  Code: -32001 

@raghav-mylagary
Copy link
Contributor

Getting similar LSP error with the extension

[Error - 12:45:03 PM] Connection to server got closed. Server will not be restarted.
thread 'main' panicked at 'failed to execute process. Make sure you have Node installed.: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /Users/runner/work/relay/relay/compiler/crates/js-config-loader/src/loader.rs:68:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@tmitchel2
Copy link

I also get the 'Make sure you have Node installed' exception. It doesn't look like node is on the path when the compiler is being spun up. I can run it if i type node to start it, then ctrl-c out and then manually spin up the compiler in watch mode, however, I still dont see any difference. Im using eslint relay, would that cause issues?

@tbezman
Copy link
Contributor

tbezman commented Jun 26, 2022

@raghavyadavm @tmitchel2 This is pretty interesting. It seems like whatever shell VSCode is using to spin up these processes is not the shell you use in your terminal (where you have node configured).

I'm assuming you're using nvm? Could you tell me where you're configuring your shell to have node in your path? This might give me some insight into how to fix your issue.

@tbezman
Copy link
Contributor

tbezman commented Jun 26, 2022

@alex-statsig Do you think it would be possible to create a minimum repro repo so I could take a look and inspect further?

@raghav-mylagary
Copy link
Contributor

@raghavyadavm @tmitchel2 This is pretty interesting. It seems like whatever shell VSCode is using to spin up these processes is not the shell you use in your terminal (where you have node configured).

I'm assuming you're using nvm? Could you tell me where you're configuring your shell to have node in your path? This might give me some insight into how to fix your issue.

Yes, I am using nvm to manage the node. The path for the node goes to the nvm directory

which node
/Users/name/.nvm/versions/node/v16.10.0/bin/node

nvm settings

export NVM_DIR="$HOME/.nvm"
  [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"  # This loads nvm
  [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm"  # This loads nvm bash_completion

@tbezman
Copy link
Contributor

tbezman commented Jun 28, 2022

@raghavyadavm which file is that configuration in? ~/.zshrc, ~/.bashrc, ~/.bash_profile?

@raghav-mylagary
Copy link
Contributor

@raghavyadavm which file is that configuration in? ~/.zshrc, ~/.bashrc, ~/.bash_profile?

Zshrc

@tbezman
Copy link
Contributor

tbezman commented Jun 30, 2022

@raghavyadavm hmm, I wonder if it would work if you put the nvm stuff in your bashrc

@alex-statsig
Copy link
Contributor Author

alex-statsig commented Jul 3, 2022

@alex-statsig Do you think it would be possible to create a minimum repro repo so I could take a look and inspect further?

@tbezman Yeah, here's a minimal reproduction: https://github.com/statsig-io/relay-vscode-repro

Seems to hit the exact same issue of "get_schema: schema is missing (or not ready, yet) for the default project.". I'm sure the repro could probably be made smaller but just copied some of the core frameworks for simplicity.

Let me know if you have any issues with this. It uses pnpm to manage packages.

@alex-statsig
Copy link
Contributor Author

cc @tbezman any update on this? Thanks

@tbezman
Copy link
Contributor

tbezman commented Jul 15, 2022

@alex-statsig hmmm, just pulled down your repo (used pnpm) and things worked like fine. I'll try to dig deeper. @captbaritone do you have any ideas?

I'll try to do a bit of digging

@tbezman
Copy link
Contributor

tbezman commented Jul 15, 2022

@raghavyadavm any update on your issue?

@tbezman
Copy link
Contributor

tbezman commented Jul 15, 2022

@alex-statsig This line from your logs seems sus

[DEBUG] error: Watchman error: While invoking the watchman CLI to discover the server connection details: No such file or directory (os error 2), stderr=``

Maybe you and @raghavyadavm have the same root cause issue. I'm thinking VSCode's default shell isn't using the shell where you add your watchman binary to the path. For @raghavyadavm I think it's not finding his node binary in the path.

@tbezman
Copy link
Contributor

tbezman commented Jul 15, 2022

This seems very inline with what I'm thinking microsoft/vscode-languageserver-node#358 . Looks like the process started by VSCode does not inherit your shell environment by default.

@tbezman
Copy link
Contributor

tbezman commented Jul 15, 2022

@alex-statsig @raghavyadavm Would you mind trying out this PR? #4012

  1. Clone my PR
  2. cd compiler && cargo build
  3. There should be a file at compiler/target/debug/relay (you'll need an absolute path to this file later)
  4. cd back to the root of the repo
  5. cd vscode-extension
  6. yarn install
  7. code . to open the vscode extension directory in vscode
  8. Press F5 to run the extension.
  9. Open the VSCode settings json and set (relay.pathToRelay to the absolute path to the relay binary from earlier)
  10. Cmd+Shift+P => Reload Window
  11. See if the problem persists.

@alex-statsig
Copy link
Contributor Author

@alex-statsig @raghavyadavm Would you mind trying out this PR? #4012

  1. Clone my PR
  2. cd compiler && cargo build
  3. There should be a file at compiler/target/debug/relay (you'll need an absolute path to this file later)
  4. cd back to the root of the repo
  5. cd vscode-extension
  6. yarn install
  7. code . to open the vscode extension directory in vscode
  8. Press F5 to run the extension.
  9. Open the VSCode settings json and set (relay.pathToRelay to the absolute path to the relay binary from earlier)
  10. Cmd+Shift+P => Reload Window
  11. See if the problem persists.

Ah I didn't have watchman installed before, running "brew install watchman" seems to have resolved the issue. I'm not sure if I'm supposed to need to install it. Would you still want me to try out this PR as a fix without watchman installed?

@tbezman
Copy link
Contributor

tbezman commented Jul 16, 2022

@alex-statsig nah I think you're good with just installing watchman.

@alex-statsig
Copy link
Contributor Author

@alex-statsig nah I think you're good with just installing watchman.

Apologies, and thanks for the help debugging. Is that intentional (and just not documented clearly) or will future versions not require it?

@tbezman
Copy link
Contributor

tbezman commented Jul 22, 2022

hmmm, yeah I think the only page on the docs site that mentions watchman is here.

@alex-statsig
Copy link
Contributor Author

hmmm, yeah I think the only page on the docs site that mentions watchman is here.

Yeah, and that seems to be only if using "--watch" (which I didn't turn on the setting for in the extension). I've had no issues generally compiling relay without it

@tbezman
Copy link
Contributor

tbezman commented Aug 9, 2022

@petrbela would you mind trying this out? #3975 (comment)

@petrbela
Copy link

petrbela commented Aug 9, 2022

@tbezman Tried that, no change. nvm is loaded in bashrc.
Also, not sure if it's relevant, if I downgrade to Relay 13, I get [ERROR] Failed to read config file 'lsp'.

@tbezman
Copy link
Contributor

tbezman commented Aug 9, 2022

@petrbela yeah , relay 13 didn't support the lsp yet. hmmm im running out of ideas here. i'm not sure how to get the extension to recognize where the node binary is

@tbezman
Copy link
Contributor

tbezman commented Aug 9, 2022

really wish it didn't work on my machine haha

@petrbela
Copy link

petrbela commented Aug 10, 2022

In a surprising twist of events, I restarted VSCode (and updated to 1.70) and got this error alongside the Relay failed to start one. Then, after quitting and starting a new instance using code ., the Relay extension started working. Not sure if the shell initialization was causing the problem before or if there's some other pattern at play but I'll report back if it stops working again.

@tbezman
Copy link
Contributor

tbezman commented Aug 10, 2022

@petrbela so is the takeaway that the shell thing worked right now?

@petrbela
Copy link

petrbela commented Aug 10, 2022

@tbezman no, I'm using the production version of the extension. Seems like it was something with VSCode environment initialization but it's working now even after restarts so can't confirm for sure.

@tbezman
Copy link
Contributor

tbezman commented Aug 11, 2022

@petrbela i wonder if it's different based on whether or not you started VS Code from the cli or not

@petrbela
Copy link

petrbela commented Aug 11, 2022

The documentation seems to indicate that. Certainly got it fixed when started from the cli. Though as I said, I'm not 100% sure it's causality or just a coincidence. Still, if others are struggling with this, it would be the first thing to try.

@petrbela
Copy link

I just restarted the computer, and got the error again (apps reopen after restart). When I then quit VSCode and relaunched it from cli, it's working again. So looks very much like the initialization problem.

@alloy
Copy link
Contributor

alloy commented Nov 1, 2022

While I'm not a big fan of more configuration, this vscode issue has existed for as long as I can remember and so I don't see it being solved any time soon. Seeing as there's a high chance with node that folks are using nvm, which entirely relies on environment, would it perhaps be an idea to allow an explicit node path?

@samlof
Copy link

samlof commented Nov 7, 2022

I had the same problem. Using zsh in WSL2 and didn't have completions in bash. Copying nvm and every other path thing from .zshrc into .bashrc fixed it 👍

@ClassicDarkChocolate
Copy link

I installed node.js and watchman on Windows (instead of remote WSL) to solve the issue.

@robertt
Copy link

robertt commented Nov 25, 2022

hey all, am still having this issue. watchman and node are available in both bash and zsh (on macos), but I still get the error
thread 'tokio-runtime-worker' panicked at 'Watchman error: While invoking the watchman CLI to discover the server connection details: No such file or directory (os error 2), stderr=``', /Users/runner/work/relay/relay/compiler/crates/relay-lsp/src/server/lsp_state_resources.rs:102:25 error.

lmk if theres anything else i can provide to be helpful!

@LloydNicholson
Copy link

LloydNicholson commented Mar 20, 2024

I tracked this down to the fact that the line let client = Connector::new().connect().await?; in watchman_file_source.rs was not finding the correct watchman file path. If I change it to this then it works let client = Connector::new().watchman_cli_path("/opt/homebrew/bin/watchman").connect().await?; and the relay LSP doesn't throw an error anymore and intellisense works again

Can anyone help me here, please? I am on an M2 Mac and using bash. When I run watchman --version in a bash terminal I get this 2024.01.22.00

@toxsick
Copy link

toxsick commented Apr 9, 2024

Not sure why watchman is required here? I would rather not install watchman for this. From relay day one I always run it with --watchman false :)

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