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
108 stars 49 forks source link

CSP: Failed to save file '...' on the server #1345

Closed cvertee closed 6 months ago

cvertee commented 7 months ago

For some reason i get 'Failed to save file *.csp on the server' error in VSCode. Sometimes it does work, sometimes it doesn't. Even if i try to edit the same file i can get lucky and successfully compile it. But this probability is heavily random and can't figure out why this happens from time to time. In the Output tab ObjectScript writes successful compiles or errors while compiling CLS files. But when such save error happens in CSP file there is just nothing.

Language Server Output with verbose level only writes this when saving, no errors (uri contains path to file://)

Sending notification 'textDocument/didSave'.
Params: {
    "textDocument": {
        "uri": "..."
    }
}

IRIS Version: 2020.1 VSCode Version: 1.87.2 OS: Windows 10

cvertee commented 7 months ago

Sometimes even after successful CSP compile, whenever i add something like alert(1) and hit save it just starts giving errors. Super rarely can fix this by adding spaces after/before html tags. Line count of errored file is ~1500 but sometimes can't compile files under 300-500 lines.

cvertee commented 7 months ago

Looks like it doesn't check contents of the file on the server because whenever i add syntax errors etc it doesn't say anything about that. Maybe some issues with processing file locally?

isc-bsaviano commented 7 months ago

@cvertee The Language Server plays no role in the saving of documents so that log isn't going to help us. For local files, this extension determines the name of the CSP file by seeing if the file's path contains a web application name, and then saves the file on the server with the file's name begin the path starting at the web application folder name. For example, if you had file src/csp/user/menu.csp in your workspace and saved it, this extension would tell the server that the document name is csp/user/menu.csp. CSP saves can fail if this name is wrong. The best way to check the cause of the save failure is to get a network trace using a tool like Wireshark so we can see the REST request and response packets.

cvertee commented 7 months ago

@isc-bsaviano thanks for the response! Not sure if i will be able to use Wireshark. Maybe will think of something for corporate computer stuff

isc-bsaviano commented 6 months ago

@cvertee You can use the web gateway's HTTP Trace facility. It doesn't require you to download any other software. The UI and functionality is rudimentary but it will get the info we need to investigate this. See the web gateway management pages docs and the HTTP Trace docs.

cvertee commented 6 months ago

@isc-bsaviano Will try to look on that (or something else) later when i'll find the time, thanks.

isc-bsaviano commented 6 months ago

Hi @cvertee, just checking in to see if the trace revealed anything.

cvertee commented 6 months ago

@isc-bsaviano Hi. Not working with IRIS for now. Tried to get to Web Gateway but probably nobody will let me get there (not the admin and whatever) so still thinking on possible workarounds

isc-bsaviano commented 6 months ago

Closing this since I can't reproduce it. @cvertee please re-open if you find reliable reproduction steps.