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

Vetur crashes if checkJs is set to true and a vue file which modifies a watched value is opened #751

Closed
3 tasks done
siphomateke opened this issue Apr 3, 2018 · 7 comments
Labels

Comments

@siphomateke
Copy link

  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: Linux
  • Vetur version: 0.11.7
  • VS Code version: 1.21.1

Problem

When checkJs is set to true in tsconfig.json or jsconfig.json and a .vue file which modifies a watched value is opened, Vetur crashes.

Vetur crash

vetur crash4

Vetur crashing on files like this is almost identical to #191 (comment)

There is no output from Vue Language Server as it appears to crash. However, there is output from the Window log:

[renderer3] [error] Channel has been closed: Error: Channel has been closed
	at ExtHostOutputChannel.validate (/usr/share/vscode/resources/app/out/vs/workbench/node/extensionHostProcess.js:35883:23)
	at ExtHostOutputChannel.appendLine (/usr/share/vscode/resources/app/out/vs/workbench/node/extensionHostProcess.js:35863:18)
	at LanguageClient.error (/home/USER/.vscode/extensions/octref.vetur-0.11.7/node_modules/vscode-languageclient/lib/client.js:1592:28)
	at LanguageClient.logFailedRequest (/home/USER/.vscode/extensions/octref.vetur-0.11.7/node_modules/vscode-languageclient/lib/client.js:2050:14)
	at client.sendRequest.then (/home/USER/.vscode/extensions/octref.vetur-0.11.7/node_modules/vscode-languageclient/lib/client.js:721:24)
	at <anonymous>
Extensions CoenraadS.bracket-pair-colorizer
EditorConfig.EditorConfig
Keno.uikit-3-snippets
Shan.code-settings-sync
Sophisticode.php-formatter
WakaTime.vscode-wakatime
asabil.meson
christian-kohler.npm-intellisense
christian-kohler.path-intellisense
dbaeumer.vscode-eslint
demijollamaxime.bulma
donjayamanne.githistory
ecmel.vscode-html-css
felixfbecker.php-intellisense
formulahendry.auto-close-tag
formulahendry.auto-rename-tag
hnw.vscode-auto-open-markdown-preview
joelday.docthis
mblode.twig-language
minhthai.vscode-todo-parser
ms-python.python
octref.vetur
patrys.vscode-code-outline
rebornix.project-snippets
robertohuertasm.vscode-icons
wayou.vscode-todo-highlight
yycalm.linecount
zhuangtongfa.Material-theme

Reproducible Case

Open nextgensparx/veturpack in VS Code and then client/components/Test.vue.

It's worth noting that if data2 is changed to data3 in watch, the issue goes away.

@HerringtonDarkholme
Copy link
Member

Thanks for reporting. I guess this problem comes from TS server.

I will investigate more and report issue to related team.

@HerringtonDarkholme
Copy link
Member

I saw this error:

.vscode/extensions/octref.vetur-0.11.7/server/node_modules/typescript/lib/typescript.js:72587
throw e;
^

TypeError: Cannot read property 'parameters' of undefined
at inferFromAnnotatedParameters

@HerringtonDarkholme
Copy link
Member

HerringtonDarkholme commented Apr 6, 2018

Boiled down version:

func.ts

interface ComponentOptions<V> {
  watch: Record<string, WatchHandler<any>>;
}
type WatchHandler<T> = (val: T) => void;
declare function extend(options: ComponentOptions<{}>): void;
export var vextend = extend
import {vextend} from './func'
// hover on vextend
export var a = vextend({
  watch: {
    data1(val) {
      this.data2 = 1
    },
    data2(val) { }
  }
})

tsconfig.json

{
  "compilerOptions": {
    "checkJs": true,
    "allowJs": true
  }
}

Error:

Error processing request. Cannot set property 'typeParameters' of undefined
TypeError: Cannot set property 'typeParameters' of undefined
    at assignContextualParameterTypes (/project/node_modules/typescript/lib/tsserver.js:36049:38)
    at checkFunctionExpressionOrObjectLiteralMethod (/project/node_modules/typescript/lib/tsserver.js:36336:29)
    at checkObjectLiteralMethod (/project/node_modules/typescript/lib/tsserver.js:37103:38)
    at checkObjectLiteral (/project/node_modules/typescript/lib/tsserver.js:33798:32)
    at checkExpressionWorker (/project/node_modules/typescript/lib/tsserver.js:37192:28)
    at checkExpression (/project/node_modules/typescript/lib/tsserver.js:37144:42)
    at checkExpressionForMutableLocation (/project/node_modules/typescript/lib/tsserver.js:37088:24)
    at checkPropertyAssignment (/project/node_modules/typescript/lib/tsserver.js:37096:20)
    at checkObjectLiteral (/project/node_modules/typescript/lib/tsserver.js:33795:32)
    at checkExpressionWorker (/project/node_modules/typescript/lib/tsserver.js:37192:28)
    at checkExpression (/project/node_modules/typescript/lib/tsserver.js:37144:42)
    at checkExpressionWithContextualType (/project/node_modules/typescript/lib/tsserver.js:37034:26)
    at checkApplicableSignature (/project/node_modules/typescript/lib/tsserver.js:35155:25)
    at chooseOverload (/project/node_modules/typescript/lib/tsserver.js:35460:26)
    at resolveCall (/project/node_modules/typescript/lib/tsserver.js:35380:26)
    at resolveCallExpression (/project/node_modules/typescript/lib/tsserver.js:35567:20)
    at resolveSignature (/project/node_modules/typescript/lib/tsserver.js:35762:28)
    at getResolvedSignature (/project/node_modules/typescript/lib/tsserver.js:35782:26)
    at Object.getResolvedSignature (/project/node_modules/typescript/lib/tsserver.js:21856:34)
    at Object.getSymbolDisplayPartsDocumentationAndSymbolKind (/project/node_modules/typescript/lib/tsserver.js:75554:45)
    at Object.getQuickInfoAtPosition (/project/node_modules/typescript/lib/tsserver.js:84632:39)
    at IOSession.Session.getQuickInfoWorker (/project/node_modules/typescript/lib/tsserver.js:91480:62)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/project/node_modules/typescript/lib/tsserver.js:90597:61)
    at /project/node_modules/typescript/lib/tsserver.js:92067:88
    at IOSession.Session.executeWithRequestId (/project/node_modules/typescript/lib/tsserver.js:92058:28)
    at IOSession.Session.executeCommand (/project/node_modules/typescript/lib/tsserver.js:92067:33)
    at IOSession.Session.onMessage (/project/node_modules/typescript/lib/tsserver.js:92087:35)
    at Interface.<anonymous> (/project/node_modules/typescript/lib/tsserver.js:93288:27)
    at emitOne (events.js:96:13)
    at Interface.emit (events.js:191:7)
    at Interface._onLine (readline.js:241:10)
    at Interface._normalWrite (readline.js:384:12)
    at Socket.ondata (readline.js:101:10)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at readableAddChunk (_stream_readable.js:178:18)
    at Socket.Readable.push (_stream_readable.js:136:10)
    at Pipe.onread (net.js:560:20)

@HerringtonDarkholme
Copy link
Member

This issue has already been tracked in microsoft/TypeScript#23198.

Let's patiently await TS team's fix. Meanwhile we cannot do much in Vue side, so I will close this issue for now.

@siphomateke
Copy link
Author

@HerringtonDarkholme Can this be fixed now that microsoft/TypeScript#23198 has been closed? The latest version of Vetur (0.16.2) still crashes on the reproduction repository mentioned above.

@octref
Copy link
Member

octref commented Mar 21, 2019

image

This seems to be solved in TS 3.3, which you can get by:

See #682 for details.

This issue will be completely gone after #1163.

@siphomateke
Copy link
Author

@octref Thanks! That fixes the issue.

siphomateke added a commit to siphomateke/zra-helper that referenced this issue Mar 23, 2019
There is a longstanding Vetur bug that causes it to crash in this project. Using Typescript version 3.3 fixes the bug but Vetur hasn't updated to it yet. Thus, this version of Typescript must be instlalled locally until Vetur is updated.

See vuejs/vetur#751 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants