Open Ansa211 opened 5 years ago
I know about this flaw and I agree it is quite confusing/annoying. Unfortunately this will require some time to rethink respective parts of the editor/parser code. Basically, the issue is how/where to bind individual query checking functions within an AST of a CQL query.
I've made a slight change (see https://github.com/czcorpus/kontext/pull/2801) in the CQL editor/parser. It is still far from perfect (one can complain that now it triggers the message too late) but at least the structure check is now consistent with the rest - once a "human understandable" parent non-terminal symbol is consumed we trigger the check. With the time I can spend on this and with my level of knowledge of the domain I probably can't do much better at the moment. More sophisticated solution would probably require a) slight rewrite of some parts of the grammar to introduce helper non-terminals for binding the checks (or) b) some stateful automaton-like processing of AST to be able to detect exact positions (nodes) where we can trigger the check.
Tested with UD 2.3 - Afrikaans AfriBooms on production. Choose CQL query type. Start entering the name of the
<doc>
structure. When you are at<d
, there is a warning saying Structure does not exist: d. I think this is a little confusing, the warning should come up only when I input a string that cannot be extended into a name of an existing structure.On the other hand, let's try to input a non-existent attribute name. I can go as far as
![warning1](https://user-images.githubusercontent.com/1833866/58045354-83c08100-7b42-11e9-8502-432af5e036e2.jpeg)
[damnit="" & omg=""
with no warning, although the fact that I have input a nonexistent attribute name should be obvious at the moment I enter the first=
(or earlier). The warning about non-existent attribute names appears at the moment when I enter the closing]
: