scztt / vscode-supercollider

MIT License
54 stars 6 forks source link

"ERROR: Message 'open' not understood": when opening schelp file from Help Browser #25 #27

Closed prko closed 10 months ago

prko commented 10 months ago

Thanks for the fix for https://github.com/scztt/vscode-supercollider/issues/25 I am now experiencing the following problem:

ERROR: Message 'open' not understood.
Perhaps you misspelled 'new', or meant to call 'open' on another receiver?
RECEIVER:
class Document (0x138c3c580) {
  instance variables [19]
    name : Symbol 'Document'
    nextclass : instance of Meta_DocumentFile (0x130e41e40, size=19, set=5)
    superclass : Symbol 'Object'
    subclasses : instance of Array (0x1313f9140, size=1, set=2)
    methods : instance of Array (0x138c3c700, size=27, set=5)
    instVarNames : instance of SymbolArray (0x138c3c980, size=9, set=3)
    classVarNames : instance of SymbolArray (0x138c3cc00, size=9, set=3)
    iprototype : instance of Array (0x138c3ca80, size=9, set=4)
    cprototype : instance of Array (0x138c3cd00, size=9, set=4)
    constNames : nil
    constValues : nil
    instanceFormat : Integer 0
    instanceFlags : Integer 0
    classIndex : Integer 1316
    classFlags : Integer 0
    maxSubclassIndex : Integer 1317
    filenameSymbol : Symbol '/Users/prko/Library/Application Support/SuperCollider/downloaded-quarks/LanguageServer/LSPDocument.sc'
    charPos : Integer 1517
    classVarIndex : Integer 673
}
ARGS:
Instance of String {    (0x12cf459e8, gc=AC, fmt=07, flg=00, set=04)
  indexed slots [170]
      0 : /
      1 : U
      2 : s
      3 : e
      4 : r
      5 : s
      6 : /
      7 : p
      8 : r
      9 : k
     10 : o
     11 : /
     12 : D
     13 : r
     14 : o
     15 : p
     16 : b
     17 : o
     18 : x
     19 : /
     20 : p
     21 : r
     22 : k
     23 : o
     24 : /
     25 : _
     26 : _
     27 : m
     28 : y
     29 : D
     30 : o
     31 : c
    ...
}
   Integer 0
   Integer 0
CALL STACK:
    DoesNotUnderstandError:reportError
        arg this = <instance of DoesNotUnderstandError>
    Nil:handleError
        arg this = nil
        arg error = <instance of DoesNotUnderstandError>
    Thread:handleError
        arg this = <instance of Thread>
        arg error = <instance of DoesNotUnderstandError>
    Object:throw
        arg this = <instance of DoesNotUnderstandError>
    Object:doesNotUnderstand
        arg this = <instance of Meta_Document>
        arg selector = 'open'
        arg args = [*3]
    String:openDocument
        arg this = "/Users/prko/Dropbox/prko/__m..."
        arg selectionStart = 0
        arg selectionLength = 0
        var ideClass = nil
    < FunctionDef in Method HelpBrowser:redirectTextFile >
        arg x = ".schelp"
        var path = "/Users/prko/Dropbox/prko/__m..."
    ArrayedCollection:do
        arg this = [*5]
        arg function = <instance of Function>
        var i = 3
    HelpBrowser:redirectTextFile
        arg this = <instance of HelpBrowser>
        arg url = "file:///Users/prko/Dropbox/p..."
        var plainTextExts = [*5]
    < FunctionDef in Method HelpBrowser:init >
        arg wv = <instance of WebView>
        arg url = "file:///Users/prko/Dropbox/p..."
        var redirected = nil
        var newPath = nil
        var oldPath = nil
    QObject:doFunction
        arg this = <instance of WebView>
        arg f = <instance of Function>
        arg args = [*3]
^^ ERROR: Message 'open' not understood.
Perhaps you misspelled 'new', or meant to call 'open' on another receiver?
RECEIVER: Document
scztt commented 10 months ago

Unfortunately, this is a limitation of the language server right now: there's not a clear way for a language server to tell the client (e.g. VSCode) to open a document. This can be fixed, but it would need a mechanism outside of the regular Language Sever Protocol API.

If anyone can find an existing API that might be appropriate for telling a client to open a file, I can try to hook it up: https://microsoft.github.io/language-server-protocol/specifications/lsp

scztt commented 10 months ago

Oh! Of course, I just found it :) https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#window_showDocument

Added an enhancement ticket for this, so I'll close this one. https://github.com/scztt/LanguageServer.quark/issues/16

scztt commented 10 months ago

Most of this work was already done, but there was one small piece missing. This should be resolved in the latest vscode visx, but if it is not I can post a new build that has the fix.

prko commented 10 months ago

Thank you very much!!!