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

Better handling of "Routine XYZ does not exist in namespace" Intellisense warning #328

Closed CacioGit closed 2 months ago

CacioGit commented 2 months ago

Type: Bug

Assume the simple code extract:

S nsp=$NAMESPACE ZN "%SYS" S res=$$BACKUP^DBACK("","F","Full Backup",cbkDir"FullDBList"$ZD($H,8)".cbk",,"./Backup/FullDBList"$ZD($H,8)_".log","NOISY",,,) ZN nsp

Intellisense is marking the call to ^DBACK as an issue, as the routine doesnt exist in the current namespace. I did not find any way to tell VSCode to aknoledge the "false positive" alert and ignore it.

Extension version: 2.5.0 VS Code version: Code 1.89.0 (b58957e67ee1e712cebf466b995adf4c5307b2bd, 2024-05-01T02:10:10.196Z) OS version: Darwin x64 23.4.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|2, 2, 3| |Memory (System)|16.00GB (0.05GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
gjsjohnmurray commented 2 months ago

Related: #77, #177, #206

isc-bsaviano commented 2 months ago

@CacioGit Thanks for reporting this, I will try to reproduce it. There isn't a way to tell VS Code to "ignore" a specific problem, but you can turn off routine existence diagnostics temporarily if that would help. The setting is intersystems.language-server.diagnostics.routines.

CacioGit commented 2 months ago

intersystems.language-server.diagnostics.routines did the trick and removed the quite annoying "1 issue with this code" warning flag.

From the previous discussions on similar issues, I can see how it is not really that easy to implement such a logic within the Intellisense's module.

Feel free to close the issue, unless the multiple reports of a similar request may trigger considering possible workarounds/solutions.

Thank you John and Brett.

isc-bsaviano commented 2 months ago

@CacioGit This should work due to my fix for #312. My fix is probably buggy when switching namespaces. I will investigate.

isc-bsaviano commented 2 months ago

@CacioGit This turned out to be a very small bug in our namespace switching detection code. You can download a version of this extension with the fix here. You'll need the darwin-x64 version because you have an Intel mac.

CacioGit commented 2 months ago

Perfect, thank you Brett, I really appreciate your work in fixing this so quickly! I will test the beta build later today and drop a comment here if it doesn't resolve the issue on my VSCode instance.

isc-bsaviano commented 2 months ago

@CacioGit My original fix was incomplete, so I committed an updated one. The properly fixed version is here.