jshinonome / vscode-q

vscode kdb+/q extension
GNU General Public License v3.0
41 stars 16 forks source link

server exporer fails when the server contains a specific value #84

Closed derekwisong closed 2 years ago

derekwisong commented 2 years ago

Hi Jo,

If the server contains:

.core.projnull: enlist first 1_(value (;));

which looks like (::) but isnt...

the lambda you use to crawl the server fails...

q)f
"{[excludedNamespaces]\n    r: flip `n`p!\"SS\"$\\:();\n    f: {sv[`]each x,'..
q)value f
'type
  [6]  {
        if[(@[(::)~first value@;x;{0b}])&11h=type n:key x;r:(y[x] n), 'x];
                                        ^
        if[count r;r,:(,/).z.s[;y]each r[;0]];:r
q))x
`.core.projnull
q))0N! .core.projnull;
,::
q))@[(::)~first value@;x;{0b}]
~[::;]
q))/ this is not what you expected to find...

You can see it looks like the identity/unary null (::) ... but it isnt..

q))value x
::
q))type value x
0h

q))(::) ~ value x
0b

Perhaps you should skip items that raise errors...

Regards, Derek

jshinonome commented 2 years ago

Thanks for raising this, Derek. I will take a look this week.

derekwisong commented 2 years ago

Thanks Jo! This particular item is a bit of a q/kdb curiosity. It is used to create projections for use in parse trees... It also has some very peculiar properties...

I made a small mistake above, it looks like the enlisted identity ::... but isnt...

.core.projnull: enlist first 1_(value (;));
q)enlist[::] ~ .core.projnull
1b

Even though q says they are the same... they are not...

q)f:{x-y};
q)eval ((f;.core.projnull;10); 100)     / creating projection f[;10] with a parse tree
90
q)eval ((f;enlist[::];10); 100)    / not quite the same as enlist ::
'type
  [1]  f:{x-y}
           ^
q))
jshinonome commented 2 years ago

Published 3.1.1, give it a try in 15 mins, and let me know if it is fixed.

derekwisong commented 2 years ago

Thanks! I wont be able to test it immediately at work where I'm actually having the problem (end users get updates via an internally managed mirror that gets updates on some unknown-to-me cadence). I should get it here in a few days.

But, I will test it at home tomorrow.

Thanks again Jo!

jshinonome commented 2 years ago

You are welcome :)

derekwisong commented 2 years ago

The admins must have been smiling on me. The update happened, and i see that the server explorer now works (and has an entry for .core.projnull)!

Thanks @jshinonome

jshinonome commented 2 years ago

No problem. Happy that it works :)