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

Receiving error "Vue Semantic Server client: couldn't create connection to server." since upgrading to 1.0.0 #1942

Closed
alan-strickland-red opened this issue Oct 7, 2022 · 25 comments
Labels
bug Something isn't working

Comments

@alan-strickland-red
Copy link

Hi,

Since VSC upgraded to Volar to 1.0.0 automatically this afternoon I am getting errors when loading .vue files.

image

The output window for the Vue Semantic Server shows the following errors repeatedly:

[Error - 16:15:48] Server initialization failed.
  Message: Request initialize failed with message: Cannot read properties of undefined (reading 'createLanguageService')
  Code: -32603 
[Error - 16:15:48] Vue Semantic Server client: couldn't create connection to server.
  Message: Request initialize failed with message: Cannot read properties of undefined (reading 'createLanguageService')
  Code: -32603 
[Info  - 16:15:50] Connection to server got closed. Server will restart.

The output window for the Vue Syntactic Server shows the following errors repeatedly:

[Error - 16:15:48] Server initialization failed.
  Message: Request initialize failed with message: Cannot read properties of undefined (reading 'createLanguageService')
  Code: -32603 
[Error - 16:15:48] Vue Syntactic Server client: couldn't create connection to server.
  Message: Request initialize failed with message: Cannot read properties of undefined (reading 'createLanguageService')
  Code: -32603 
[Info  - 16:15:50] Connection to server got closed. Server will restart.

I have downgraded to Volar 0.4 and that has resolved the issue for the time being.

@johnsoncodehk
Copy link
Member

It seems a same problem: #1880 (comment)

But I don't know how it resolve, can you try reinstall extension and restart vscode?

@rchl
Copy link
Collaborator

rchl commented Oct 7, 2022

I've just tried 1.0.0-rc.5 in ST and got it:

Details
{
  "capabilities": {
    "general": {
      "markdown": {
        "parser": "Python-Markdown",
        "version": "3.2.2"
      },
      "regularExpressions": {
        "engine": "ECMAScript"
      }
    },
    "textDocument": {
      "codeAction": {
        "codeActionLiteralSupport": {
          "codeActionKind": {
            "valueSet": [
              "quickfix",
              "refactor",
              "refactor.extract",
              "refactor.inline",
              "refactor.rewrite",
              "source.fixAll",
              "source.organizeImports"
            ]
          }
        },
        "dataSupport": true,
        "disabledSupport": true,
        "dynamicRegistration": true,
        "isPreferredSupport": true,
        "resolveSupport": {
          "properties": [
            "edit"
          ]
        }
      },
      "codeLens": {
        "dynamicRegistration": true
      },
      "colorProvider": {
        "dynamicRegistration": true
      },
      "completion": {
        "completionItem": {
          "deprecatedSupport": true,
          "documentationFormat": [
            "markdown",
            "plaintext"
          ],
          "insertReplaceSupport": true,
          "insertTextModeSupport": {
            "valueSet": [
              2
            ]
          },
          "labelDetailsSupport": true,
          "resolveSupport": {
            "properties": [
              "detail",
              "documentation",
              "additionalTextEdits"
            ]
          },
          "snippetSupport": true,
          "tagSupport": {
            "valueSet": [
              1
            ]
          }
        },
        "completionItemKind": {
          "valueSet": [
            6,
            7,
            12,
            22,
            14,
            10,
            19,
            2,
            5,
            15,
            8,
            4,
            1,
            16,
            13,
            9,
            3,
            20,
            21,
            18,
            24,
            23,
            11,
            25,
            17
          ]
        },
        "dynamicRegistration": true,
        "insertTextMode": 2
      },
      "declaration": {
        "dynamicRegistration": true,
        "linkSupport": true
      },
      "definition": {
        "dynamicRegistration": true,
        "linkSupport": true
      },
      "documentHighlight": {
        "dynamicRegistration": true
      },
      "documentLink": {
        "dynamicRegistration": true,
        "tooltipSupport": true
      },
      "documentSymbol": {
        "dynamicRegistration": true,
        "hierarchicalDocumentSymbolSupport": true,
        "symbolKind": {
          "valueSet": [
            3,
            23,
            10,
            4,
            7,
            6,
            8,
            5,
            9,
            1,
            19,
            16,
            25,
            12,
            22,
            2,
            15,
            14,
            11,
            21,
            18,
            26,
            24,
            17,
            20,
            13
          ]
        },
        "tagSupport": {
          "valueSet": [
            1
          ]
        }
      },
      "formatting": {
        "dynamicRegistration": true
      },
      "hover": {
        "contentFormat": [
          "markdown",
          "plaintext"
        ],
        "dynamicRegistration": true
      },
      "implementation": {
        "dynamicRegistration": true,
        "linkSupport": true
      },
      "inlayHint": {
        "dynamicRegistration": true,
        "resolveSupport": {
          "properties": [
            "textEdits",
            "label.command"
          ]
        }
      },
      "publishDiagnostics": {
        "codeDescriptionSupport": true,
        "dataSupport": true,
        "relatedInformation": true,
        "tagSupport": {
          "valueSet": [
            2,
            1
          ]
        },
        "versionSupport": true
      },
      "rangeFormatting": {
        "dynamicRegistration": true
      },
      "references": {
        "dynamicRegistration": true
      },
      "rename": {
        "dynamicRegistration": true,
        "prepareSupport": true
      },
      "selectionRange": {
        "dynamicRegistration": true
      },
      "semanticTokens": {
        "augmentsSyntaxTokens": true,
        "dynamicRegistration": true,
        "formats": [
          "relative"
        ],
        "multilineTokenSupport": true,
        "overlappingTokenSupport": false,
        "requests": {
          "full": {
            "delta": true
          },
          "range": true
        },
        "tokenModifiers": [
          "deprecated",
          "documentation",
          "abstract",
          "definition",
          "async",
          "modification",
          "readonly",
          "static",
          "declaration",
          "defaultLibrary"
        ],
        "tokenTypes": [
          "macro",
          "class",
          "namespace",
          "struct",
          "keyword",
          "modifier",
          "method",
          "parameter",
          "comment",
          "type",
          "enum",
          "number",
          "interface",
          "function",
          "enumMember",
          "string",
          "property",
          "event",
          "regexp",
          "operator",
          "typeParameter",
          "decorator",
          "variable"
        ]
      },
      "signatureHelp": {
        "contextSupport": true,
        "dynamicRegistration": true,
        "signatureInformation": {
          "activeParameterSupport": true,
          "documentationFormat": [
            "markdown",
            "plaintext"
          ],
          "parameterInformation": {
            "labelOffsetSupport": true
          }
        }
      },
      "synchronization": {
        "didSave": true,
        "dynamicRegistration": true,
        "willSave": true,
        "willSaveWaitUntil": true
      },
      "typeDefinition": {
        "dynamicRegistration": true,
        "linkSupport": true
      }
    },
    "window": {
      "showDocument": {
        "support": true
      },
      "showMessage": {
        "messageActionItem": {
          "additionalPropertiesSupport": true
        }
      },
      "workDoneProgress": true
    },
    "workspace": {
      "applyEdit": true,
      "codeLens": {
        "refreshSupport": true
      },
      "configuration": true,
      "didChangeConfiguration": {
        "dynamicRegistration": true
      },
      "didChangeWatchedFiles": {
        "dynamicRegistration": true
      },
      "executeCommand": {},
      "inlayHint": {
        "refreshSupport": true
      },
      "semanticTokens": {
        "refreshSupport": true
      },
      "symbol": {
        "dynamicRegistration": true,
        "symbolKind": {
          "valueSet": [
            3,
            23,
            10,
            4,
            7,
            6,
            8,
            5,
            9,
            1,
            19,
            16,
            25,
            12,
            22,
            2,
            15,
            14,
            11,
            21,
            18,
            26,
            24,
            17,
            20,
            13
          ]
        },
        "tagSupport": {
          "valueSet": [
            1
          ]
        }
      },
      "workspaceEdit": {
        "documentChanges": true,
        "failureHandling": "abort"
      },
      "workspaceFolders": true
    }
  },
  "clientInfo": {
    "name": "Sublime Text LSP",
    "version": "1.18.0"
  },
  "initializationOptions": {
    "documentFeatures": {
      "documentColor": true,
      "documentFormatting": {
        "defaultPrintWidth": 90
      },
      "documentSymbol": true,
      "foldingRange": true,
      "linkedEditingRange": false,
      "selectionRange": true
    },
    "languageFeatures": {
      "callHierarchy": false,
      "codeAction": true,
      "codeLens": {
        "showReferencesNotification": true
      },
      "completion": {
        "defaultAttrNameCase": "kebabCase",
        "defaultTagNameCase": "both",
        "getDocumentNameCasesRequest": false,
        "getDocumentSelectionRequest": false,
        "ignoreTriggerCharacters": ""
      },
      "definition": true,
      "diagnostics": true,
      "documentHighlight": true,
      "documentLink": true,
      "hover": true,
      "implementation": true,
      "inlayHints": true,
      "references": true,
      "rename": true,
      "renameFileRefactoring": false,
      "schemaRequestService": false,
      "semanticTokens": true,
      "signatureHelp": true,
      "typeDefinition": true,
      "workspaceSymbol": true
    },
    "textDocumentSync": 2,
    "typescript": {
      "serverPath": "/Users/rafal/Library/Caches/Sublime Text/Package Storage/LSP-volar/16.15.0/server/node_modules/typescript/lib/tsserverlibrary.js"
    }
  },
  "processId": 80686,
  "rootPath": "/Users/rafal/Downloads/XXX",
  "rootUri": "file:///Users/rafal/Downloads/XXX",
  "workspaceFolders": [
    {
      "name": "Tidal Voucher Project",
      "uri": "file:///Users/rafal/Downloads/XXX"
    }
  ]
}
{
  "code": -32603,
  "message": "Request initialize failed with message: Cannot read properties of undefined (reading 'createLanguageService')"
}

I suppose it has to do with initializationOptions but if this payload alone doesn't help you then I can investigate further.

(note that it tries to use typescript v4.8.4)

EDIT: Also tried with @volar/vue-language-server@1.0.0 but the same

@alan-strickland-red
Copy link
Author

I have tried re-installing it and restarting vscode and even restarting the machine.

My colleague and I have the same setup and his is working with the latest extendion so I enabled the verbose logging you mentioned on the other thread and compared it between the two environments, the only difference is in the typescript initializationOptions where the tsdk path on mine is pointing at the workspace and his is posing at the global install.

Working

    "initializationOptions": {
        "serverMode": 0,
        "diagnosticModel": 1,
        "textDocumentSync": 2,
        "typescript": {
            "tsdk": "c:\\Users\\*******\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\node_modules\\typescript\\lib",
            "isWorkspacePath": false
        },
        "petiteVue": {
            "processHtmlFile": false
        },
        "vitePress": {
            "processMdFile": false
        },
        "cancellationPipeName": "C:\\Users\\******L\\AppData\\Local\\Temp\\vscode-Vue.volar-cancellation-pipe.tmp"
    },

Failing

    "initializationOptions": {
        "serverMode": 0,
        "diagnosticModel": 1,
        "textDocumentSync": 2,
        "typescript": {
            "tsdk": "d:\\******\\******\\******",
            "isWorkspacePath": true
        },
        "petiteVue": {
            "processHtmlFile": false
        },
        "vitePress": {
            "processMdFile": false
        },
        "cancellationPipeName": "C:\\Users\\*******\\AppData\\Local\\Temp\\vscode-Vue.volar-cancellation-pipe.tmp"
    },

@johnsoncodehk
Copy link
Member

@rchl please try update initializationOptions (See #1916):

"initializationOptions": {
-    "documentFeatures": {
-      "documentColor": true,
-      "documentFormatting": {
-        "defaultPrintWidth": 90
-      },
-      "documentSymbol": true,
-      "foldingRange": true,
-      "linkedEditingRange": false,
-      "selectionRange": true
-    },
-    "languageFeatures": {
-      "callHierarchy": false,
-      "codeAction": true,
-      "codeLens": {
-        "showReferencesNotification": true
-      },
-      "completion": {
-        "defaultAttrNameCase": "kebabCase",
-        "defaultTagNameCase": "both",
-        "getDocumentNameCasesRequest": false,
-        "getDocumentSelectionRequest": false,
-        "ignoreTriggerCharacters": ""
-      },
-      "definition": true,
-      "diagnostics": true,
-      "documentHighlight": true,
-      "documentLink": true,
-      "hover": true,
-      "implementation": true,
-      "inlayHints": true,
-      "references": true,
-      "rename": true,
-      "renameFileRefactoring": false,
-      "schemaRequestService": false,
-      "semanticTokens": true,
-      "signatureHelp": true,
-      "typeDefinition": true,
-      "workspaceSymbol": true
-    },
+    "ignoreTriggerCharacters": ""
    "textDocumentSync": 2,
    "typescript": {
-      "serverPath": "/Users/rafal/Library/Caches/Sublime Text/Package Storage/LSP-volar/16.15.0/server/node_modules/typescript/lib/tsserverlibrary.js"
+      "tsdk": "/Users/rafal/Library/Caches/Sublime Text/Package Storage/LSP-volar/16.15.0/server/node_modules/typescript/lib"
    }
  }

@rchl
Copy link
Collaborator

rchl commented Oct 7, 2022

@rchl please try update initializationOptions (See #1916):

That helped. Thanks.

@rchl
Copy link
Collaborator

rchl commented Oct 7, 2022

Failing

In my case above it was about the path pointing to a file rather than the lib dir. You've masked yours in the failing case so hard to tell whether it's the same issue.

Also I guess make sure that the directory and files within it do exist.

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Oct 7, 2022

@alan-strickland-red I just found a way to reproduce it under specific conditions, please wait for v1.0.1.

Reproduce steps:

  1. Change to Use VSCode Version tsdk in status bar
  2. Clear .vscode/settings.json content.
  3. Change to Use Workspace Version tsdk in status bar

@johnsoncodehk johnsoncodehk added the bug Something isn't working label Oct 7, 2022
@alan-strickland-red
Copy link
Author

@johnsoncodehk Thank you.
@rchl If it helps the masked path was pointing at the root directory of the VSC workspace

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Oct 7, 2022

@alan-strickland-red You can try to change to VSCode Version tsdk in status bar to avoid this problem for now.

@alan-strickland-red
Copy link
Author

@johnsoncodehk That's fixed it. I changed to "Use Workspace Version 4.8.4", note of interest switching back to "Use VC Code's Version" also works.

image

@carlos00027
Copy link

+1

@carlos00027
Copy link

I installed the previous version of fly and it worked for me. as a temporary solution.

@do-block
Copy link

Sorry to bother you all, but this problem has prevented me from using vscode to write vue projects, and using the above method has not solved the error and plugin failure.

@www-wanglong
Copy link

+1

@dev-bazz
Copy link

Same problem, downgrading the plugin worked

@jeppeerixon
Copy link

Just started showing up for me aswell.

@tw-luo
Copy link

tw-luo commented Apr 22, 2023

Same problem, downgrading the plugin worked

May I know which version you have downgraded to?

@tw-luo
Copy link

tw-luo commented Apr 22, 2023

Same problem, downgrading the plugin worked

May I know which version you have downgraded to?

I downgraded to version 1.4.0 ,it can run normally

@MartinsOnuoha
Copy link

MartinsOnuoha commented Apr 22, 2023

Same problem, I think this must have happened with an update as it only started yesterday. When I check the output I see:

Request initialize failed with message: Can't find typescript.js or tsserverlibrary.js in ms-vscode.vscode-typescript-next

So what this tells me is that this problem has something to do with the Microsoft official typescript extension. What to do?, Here's some solution that'll work. Open your extension list and disable this extension for your workspace.

CleanShot 2023-04-22 at 12 26 24@2x

Alternatively, install a different version of the extension.

CleanShot 2023-04-22 at 12 28 18@2x

However, for me, it only worked after disabling the extension. I guess there might be some incompatibility with Volar and vscode-typescript-next recent changes.

@GaoJuqian
Copy link

image

@johnsoncodehk
Copy link
Member

Please update your extension to v1.4.3 or later, and please don't reply on an obsolete issue.

@MartinsOnuoha
Copy link

Please update your extension to v1.4.3 or later, and please don't reply on an obsolete issue.

@johnsoncodehk Thanks, I see this is resolved in v1.4.3.
I wouldn't call it "replying to an obsolete issue" since this was happening as of v1.4.2 and x.x.3 was only published 11 hours ago 🙂. Thanks

@GaoJuqian
Copy link

👍

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Apr 23, 2023

I mean this issue (#1942) is obsolete, it has nothing to do with the problem with the new version. You should be able to see the prompt message from github.

image

@MartinsOnuoha
Copy link

I agree, unfortunately, it happened to be the only related issue with the most engagement and most recent comment. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests