groovy-language-server icon indicating copy to clipboard operation
groovy-language-server copied to clipboard

If a file in the workspace has syntax errors, all files fail.

Open shadycuz opened this issue 4 years ago • 1 comments

If I have two files open, a.groovy and b.groovy, and I make a syntax error in a.groovy like:

Path test = new Path('test.txt')
test.

When I switch to b.groovy then nothing works.

Here is what the trace says.

[Trace - 4:56:06 AM] Sending request 'textDocument/hover - (9)'.
Params: {
    "textDocument": {
        "uri": "file:///home/shadycuz/repos/dsty/jenkins-std-lib/src/org/dsty/os/Path.groovy"
    },
    "position": {
        "line": 22,
        "character": 6
    }
}


[Trace - 4:56:06 AM] Received response 'textDocument/hover - (9)' in 3ms.
Result: {
    "contents": {
        "kind": "markdown"
    }
}

For textDocument/completion, I actually get some useful information :

[Trace - 5:06:52 AM] Sending request 'textDocument/completion - (39)'.
Params: {
    "textDocument": {
        "uri": "file:///home/shadycuz/repos/dsty/jenkins-std-lib/src/org/dsty/os/Path.groovy"
    },
    "position": {
        "line": 298,
        "character": 27
    },
    "context": {
        "triggerKind": 1
    }
}


[Trace - 5:06:52 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///home/shadycuz/repos/dsty/jenkins-std-lib/jobs/os/path/path_example.groovy",
    "diagnostics": [
        {
            "range": {
                "start": {
                    "line": 93,
                    "character": 4
                },
                "end": {
                    "line": 93,
                    "character": 5
                }
            },
            "severity": 2,
            "message": "Unexpected input: '... CONTENTS OF THE FILE I REMOVED\n test.\\n\\n\\n    }' @ line 94, column 5."
        },
        {
            "range": {
                "start": {
                    "line": 93,
                    "character": 4
                },
                "end": {
                    "line": 93,
                    "character": 5
                }
            },
            "severity": 2,
            "message": "Unexpected input: '... CONTENTS OF THE FILE I REMOVED\n  test.\\n\\n\\n    }' @ line 94, column 5."
        }
    ]
}

maybe this is desired behavior? Not sure. I will eventually look into this.

shadycuz avatar Sep 13 '21 09:09 shadycuz

Same here. Do you had the chance to look into it ?

I cannot fix the "unexpected input" so easy because it lives in a external plugin :face_exhaling:

franzherzog avatar Dec 20 '22 16:12 franzherzog