Skip to content

Exception in getQuickInfoAtPosition #17683

Closed
@alexdima

Description

@alexdima

TypeScript Version: 2.3.4

Code

func({
 test: function() {
 },
 test() {
 }
})

Expected behavior:
Pasting this content in the monaco editor at https://microsoft.github.io/monaco-editor/ should not result in an exception when hovering over the first test.

Actual behavior:
An error occurs:

Uncaught Error: Cannot read property 'target' of undefined

TypeError: Cannot read property 'target' of undefined
    at Object.y [as buildSignatureDisplay] (/monaco-editor/node_modules/monaco-editor/min/vs/language/typescript/lib/typescriptServices.js:38)
    at /monaco-editor/node_modules/monaco-editor/min/vs/language/typescript/lib/typescriptServices.js:57
    at p (/monaco-editor/node_modules/monaco-editor/min/vs/language/typescript/lib/typescriptServices.js:57)
    at Object.m [as signatureToDisplayParts] (/monaco-editor/node_modules/monaco-editor/min/vs/language/typescript/lib/typescriptServices.js:57)
    at f (/monaco-editor/node_modules/monaco-editor/min/vs/language/typescript/lib/typescriptServices.js:60)
    at Object.i [as getSymbolDisplayPartsDocumentationAndSymbolKind] (/monaco-editor/node_modules/monaco-editor/min/vs/language/typescript/lib/typescriptServices.js:60)
    at Object.y [as getQuickInfoAtPosition] (/monaco-editor/node_modules/monaco-editor/min/vs/language/typescript/lib/typescriptServices.js:63)
    at e.getQuickInfoAtPosition (/monaco-editor/node_modules/monaco-editor/min/vs/language/typescript/src/worker.js:9)
    at t.e.fmr (/monaco-editor/node_modules/monaco-editor/min/vs/base/worker/workerMain.js:7)
    at t._handleMessage (/monaco-editor/node_modules/monaco-editor/min/vs/base/worker/workerMain.js:7)
    at Object.y [as buildSignatureDisplay] (/monaco-editor/node_modules/monaco-editor/min/vs/language/typescript/lib/typescriptServices.js:38)
    at /monaco-editor/node_modules/monaco-editor/min/vs/language/typescript/lib/typescriptServices.js:57
    at p (/monaco-editor/node_modules/monaco-editor/min/vs/language/typescript/lib/typescriptServices.js:57)
    at Object.m [as signatureToDisplayParts] (/monaco-editor/node_modules/monaco-editor/min/vs/language/typescript/lib/typescriptServices.js:57)
    at f (/monaco-editor/node_modules/monaco-editor/min/vs/language/typescript/lib/typescriptServices.js:60)
    at Object.i [as getSymbolDisplayPartsDocumentationAndSymbolKind] (/monaco-editor/node_modules/monaco-editor/min/vs/language/typescript/lib/typescriptServices.js:60)
    at Object.y [as getQuickInfoAtPosition] (/monaco-editor/node_modules/monaco-editor/min/vs/language/typescript/lib/typescriptServices.js:63)
    at e.getQuickInfoAtPosition (/monaco-editor/node_modules/monaco-editor/min/vs/language/typescript/src/worker.js:9)
    at t.e.fmr (/monaco-editor/node_modules/monaco-editor/min/vs/base/worker/workerMain.js:7)
    at t._handleMessage (/monaco-editor/node_modules/monaco-editor/min/vs/base/worker/workerMain.js:7)
    at editor.main.js:31
editor.main.js:31 Uncaught Error: Cannot read property 'target' of undefined

TypeError: Cannot read property 'target' of undefined
    at Object.y [as buildSignatureDisplay] (typescriptServices.js:38)
    at typescriptServices.js:57
    at p (typescriptServices.js:57)
    at Object.m [as signatureToDisplayParts] (typescriptServices.js:57)
    at f (typescriptServices.js:60)
    at Object.i [as getSymbolDisplayPartsDocumentationAndSymbolKind] (typescriptServices.js:60)
    at Object.y [as getQuickInfoAtPosition] (typescriptServices.js:63)
    at e.getQuickInfoAtPosition (worker.js:9)
    at t.e.fmr (workerMain.js:7)
    at t._handleMessage (workerMain.js:7)
    at Object.y [as buildSignatureDisplay] (typescriptServices.js:38)
    at typescriptServices.js:57
    at p (typescriptServices.js:57)
    at Object.m [as signatureToDisplayParts] (typescriptServices.js:57)
    at f (typescriptServices.js:60)
    at Object.i [as getSymbolDisplayPartsDocumentationAndSymbolKind] (typescriptServices.js:60)
    at Object.y [as getQuickInfoAtPosition] (typescriptServices.js:63)
    at e.getQuickInfoAtPosition (worker.js:9)
    at t.e.fmr (workerMain.js:7)
    at t._handleMessage (workerMain.js:7)
    at editor.main.js:31

Extracted from microsoft/monaco-editor#537

I can try running with typescriptServices.js from source and produce a better stack trace if you are having trouble reproducing this.

EDIT: Here is a better stack trace (when running with monaco-typescript out of source):

Uncaught Error: Cannot read property 'target' of undefined

TypeError: Cannot read property 'target' of undefined
    at Object.buildSignatureDisplay (typescriptServices.js:28694)
    at typescriptServices.js:71396
    at mapToDisplayParts (typescriptServices.js:71376)
    at Object.signatureToDisplayParts (typescriptServices.js:71395)
    at addSignatureDisplayParts (typescriptServices.js:80324)
    at Object.getSymbolDisplayPartsDocumentationAndSymbolKind (typescriptServices.js:80250)
    at Object.getQuickInfoAtPosition (typescriptServices.js:86329)
    at TypeScriptWorker.getQuickInfoAtPosition (worker.js:126)
    at t.e.fmr (/Users/alex/src/monaco-editor/node_modules/monaco-editor-core/min/vs/editor/editor.main.js:31)
    at /Users/alex/src/monaco-editor/node_modules/monaco-editor-core/min/vs/editor/editor.main.js:31
    at Object.buildSignatureDisplay (typescriptServices.js:28694)
    at typescriptServices.js:71396
    at mapToDisplayParts (typescriptServices.js:71376)
    at Object.signatureToDisplayParts (typescriptServices.js:71395)
    at addSignatureDisplayParts (typescriptServices.js:80324)
    at Object.getSymbolDisplayPartsDocumentationAndSymbolKind (typescriptServices.js:80250)
    at Object.getQuickInfoAtPosition (typescriptServices.js:86329)
    at TypeScriptWorker.getQuickInfoAtPosition (worker.js:126)
    at t.e.fmr (/Users/alex/src/monaco-editor/node_modules/monaco-editor-core/min/vs/editor/editor.main.js:31)
    at /Users/alex/src/monaco-editor/node_modules/monaco-editor-core/min/vs/editor/editor.main.js:31
    at /Users/alex/src/monaco-editor/node_modules/monaco-editor-core/min/vs/editor/editor.main.js:31

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issueVS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions