intersystems / language-server

Repository for the VS Code Language Server
https://marketplace.visualstudio.com/items?itemName=intersystems.language-server
Other
16 stars 6 forks source link

Problem with Scandic letters in classes #298

Closed atuomisto-mylab closed 7 months ago

atuomisto-mylab commented 7 months ago

Hello,

I noticed that if one has Scandic letters in class comments then language-server crashes.

This works:

Class ATU.Test Extends %RegisteredObject
{

/// Description
ClassMethod MethodName() As %Status
{
    Set sc = $$$OK
    // do something
    Return sc
}

}

This will cause a crash:

Class ATU.Test Extends %RegisteredObject
{

/// Description
ClassMethod MethodName() As %Status
{
    Set sc = $$$OK
    // do something with scandic åäö
    Return sc
}

}

Best regards, Aaro

isc-bsaviano commented 7 months ago

@atuomisto-mylab What version of the Language Server are you using? Can you look in the InterSystems Language Server Output channel and see what the cause of the crash was? I just copied that comment into a class definition that I had open and the Language Server did not crash. I'm on the latest version (2.4.0) and M1 Mac.

atuomisto-mylab commented 7 months ago

Hello,

I have windows with Ubuntu subsystem. Language server is version v2.4.0. IRIS is running in container in WSL.

Output:

/home/atuomi/.vscode-server/extensions/intersystems.language-server-2.4.0-linux-x64/server/out/server.js:2
(()=>{var __webpack_modules__={8534:(e,t,n)=>{e=n.nmd(e);try{process.dlopen(e,__dirname+n(1017).sep+n.p+"cfc3bfd4ce8380ba87bb8ba0fe112112.node")}catch(e){throw new Error("node-loader:\n"+e)}},2812:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.lookupattr=t.getLegend=t.parseDocument=void 0;const r=n(7325),i=n(8534),o=n(3812);t.parseDocument=function(e,t,n){let o="COS",a=147457;if("objectscript-class"===e?o="CLS":"objectscript-csp"===e?o="HTML":("objectscript-int"===e||"objectscript"===e&&"int"===t)&&(o="INT"),"COS"!==o&&"INT"!==o||!(0,r.isRoutineHeader)(n))return a+="HTML"===o?3072:0,{compressedlinearray:(0,i.Tokenize)(n,o,!1,a)};{const e=function(e){const t=e.indexOf("\n");return-1===t?e:t>0&&"\r"===e.charAt(t-1)?e.slice(0,t-1):e.slice(0,t)}(n),t=(0,r.colorRoutineLine)(e),s=" ".repeat(e.length)+n.slice(e.length);let c=(0,i.Tokenize)(s,o,!1,a);return c[0]=t.compressedline,{compressedlinearray:c,routineheaderinfo:t.routineheaderinfo}}};let a={};t.getLegend=function
.
.
.
[0].s==c.cls_keyword_attrindex)break;if(["objectscript","objectscript-int"].includes(e.languageId)&&d&&t[p][0].l==c.cos_langindex&&t[p][0].s==c.cos_label_attrindex){if(null!=k(e,t,p))break;d=!1}else if(t[p][0].l==c.cos_langindex&&t[p][0].s==c.cos_ppc_attrindex){if("#dim"===e.getText(i.Range.create(i.Position.create(p,t[p][0].p),i.Position.create(p,t[p][1].p+t[p][1].c))).toLowerCase()){const n=m(e,t,p,u);o=n.founddim,o&&(r={baseclass:yiel[Error - 2:07:04 PM] Server process exited with code 1.
[Error - 2:07:04 PM] The InterSystems Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

Total output is really long.

isc-bsaviano commented 7 months ago

@atuomisto-mylab Thanks for that, fortunately it's not really useful. I'm not familiar with WSL but I started up my Ubuntu 18.04 WSL2 on Windows 10 to run a quick test. I opened a node shell, loaded the node binary that does the document parsing and passed in your comment with scandic characters to be parsed. I didn't observe a crash. Does your VS Code crash when the language server loads, or are you doing something in VS Code at the time of the crash (e.g. typing, hovering over a class name etc)?

atuomisto-mylab commented 7 months ago

Hello,

I have noticed that it crashes in two situations.

  1. If I open a class file with Scandics in comment.
  2. If I start typying Scandis in comments or code.

I believe that problem is with container that I am using to run IRIS. If it has problem with locales then something like this could happen.

I will return to this tomorrow.

Br, Aaro

atuomisto-mylab commented 7 months ago

Hello,

I think that this problem occurs only if one uses IRIS dev containers. Changing locales didn't help me.

I have container running in wsl and VSCode attached to it.

Br, Aaro

isc-bsaviano commented 7 months ago

@atuomisto-mylab It shouldn't matter where the IRIS instance is located. The parser code that I think is causing the crash runs in the VS Code environment (WSL in your case). The locale issues would be there, not the IRIS container.

atuomisto-mylab commented 7 months ago

Hello,

yes, now I tested by changing locales fro wsl and it seems to work correctly.

Thank you very much from your help.

Br, Aaro

isc-bsaviano commented 7 months ago

I'm glad everything's working now!