intersystems-community / vscode-objectscript

InterSystems ObjectScript extension for Visual Studio Code
https://docs.intersystems.com/components/csp/docbook/DocBook.UI.Page.cls?KEY=GVSCO
Other
107 stars 48 forks source link

Error when hover above code #42

Closed daimor closed 5 years ago

daimor commented 5 years ago

Probably a separate bug, however when I hover above a command / intrinsic function ($get etc.) I see the information display - nice work. Hover over a non-word and the log shows [2019-07-02 10:02:15.770] [exthost] [error] TypeError: Cannot read property 'end' of undefined at ObjectScriptHoverProvider.dollars (c:\Users\Administrator.vscode\extensions\daimor.vscode-objectscript-0.7.11\out\providers\ObjectScriptHoverProvider.js:25:133)

Reviewing the typescipt I see: public dollars(document: vscode.TextDocument, position: vscode.Position): vscode.ProviderResult { const word = document.getWordRangeAtPosition(position); const text = document.getText( new vscode.Range(new vscode.Position(position.line, 0), new vscode.Position(position.line, word.end.character)), );

Probably needs some defensive coding around the word object before it's used.

On Tue, 2 Jul 2019 at 09:38, Dmitry Maslennikov notifications@github.com wrote:

Closed #41 https://github.com/daimor/vscode-objectscript/issues/41.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/daimor/vscode-objectscript/issues/41?email_source=notifications&email_token=ACWXRRR6LLXZXY6TQ2DBVJTP5MHXNA5CNFSM4H4UBGQKYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOSI7GT2I#event-2453563881, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWXRRXGB6ACXWYTMZEC3CDP5MHXNANCNFSM4H4UBGQA .

Originally posted by @davbro63 in https://github.com/daimor/vscode-objectscript/issues/41#issuecomment-507592846

daimor commented 5 years ago

@davbro63 could you share the peace of code and place, hovering which you getting this error?

davbro63 commented 5 years ago

The code is Class User.Test1 Extends %RegisteredObject {

Method Method1() As %Status { set a = $get(^B) }

}

Hover above the open brace under the Method declaration and the error appears in the Log (Extension Host) window

On Tue, 2 Jul 2019 at 10:20, Dmitry Maslennikov notifications@github.com wrote:

@davbro63 https://github.com/davbro63 could you share the peace of code and place, hovering which you getting this error?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/daimor/vscode-objectscript/issues/42?email_source=notifications&email_token=ACWXRRTDMF4C4ALUSCCM5C3P5MMW7A5CNFSM4H4ZX4EKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZAURTI#issuecomment-507594957, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWXRRVPNHKWV24GKK5PMBTP5MMW7ANCNFSM4H4ZX4EA .

daimor commented 5 years ago

Thanks, fixed