Branching off of https://kolmafia.us/threads/ash-language-server-features.26098/post-162481
MCroft, BigD and I are planning to try to add Language Server features to mafia, so that making scripts is easier. This would be done using Language Server Protocol for (4) Java.
We're starting with ASH (we'll have to see how adding the javascript part goes afterwards).
The first problems encountered are :
- textui is very poorly documented. I'm currently trying to understand it as best as I can, but if possible, can anyone with a greater understanding of this explain the inner workings of textui/parsetree? More precisely, Scope, BasicScope and ParseTreeNode, if possible?
- I noticed that script, notify, since and/or import statements are allowed at the start of literally any block, like so:
Java:script this_script_is_called_abc.ash_now; notify Fronobulax; since 20.1; import a.ash; import b.ash; static { script this_script_is_called_aaa.ash_now; notify Veracity; since 20.2; import c.ash; import d.ash; } string a_funtion() { script this_script_is_called_foo.ash_now; notify MCroft; since 20.3; import e.ash; import f.ash; for x from 1 to 10 by 5 { script this_script_is_called_bar.ash_now; notify Gausie; since 20.4; import g.ash; import h.ash; } return ""; } { import i.ash; { import j.ash; { import k.ash; } } }
(the script name and notify recipient don't actually get changed, since they can only be set once per script)
Is this what-I-can-only-call-an-abheration intentional?
This looks like a bug. The docs say you can't do this.
Fredg, did you try not having first notify? If it's only in static or the functions, does the first one fire in any listed context? I think we should split this off from the feature request. And I think the language server should act as the docs say the language acts, in this case.
My main concern is: who *made* the docs? Is it someone who truly *knew* what ash was supposed/wants to do, or is it someone who *interpreted* it?
Well, turns out that hola wrote notify and hola wrote that text on the forum, and Zarqon copied hola's text from 2006 into the wiki in 2009. But in general, we only need to rely on the wiki for things we can't deduce from code.
But it would also be really handy to see where they two diverge (as in the case you mention). Again, recommend we split this off, because it's really a different topic...