Attempts to make KQL syntax errors more sensical to the average user. I initially tried to use a similar solution to the one we used for detecting usage of old lucene syntax. In other words, I tried to create rules in the grammar that would match strings containing common mistakes the user might make and throw custom error messages for each situation. This proved to be more difficult for detecting errors in the regular language. While the Lucene rules could be completely separated from the main grammar, the KQL error rules had to be mixed into the main grammar which made it much more complex and had a lot of unintended side effects. So instead I decided to lean more heavily on PEG's built in error reporting. Giving certain rules human readable names allows the parser to use those names in the error reporting instead of auto generating a long list of possible characters that might be expected based on the matching rules. Since the PEG errors contain location information I was also able to add ascii art that points the user to exactly where the error occurred in their query string. While this approach is not quite as nice as bespoke error messages that tell the user exactly what is wrong in plain English, it's much more maintainable and I think it still results in much better error messages compared to what we have today. I've also removed the old original kuery grammar (for queries like is(response, 200)). We were only using it to display an error if I user was still using the old syntax. This version of kuery hasn't existed since 6.3 and we've had error messages telling users this since then. I think it's safe to remove the legacy parser at this point, which greatly reduces the complexity of our error reporting.
39 lines
1.2 KiB
Text
39 lines
1.2 KiB
Text
node_modules
|
|
bower_components
|
|
/data
|
|
/build
|
|
/target
|
|
/.es
|
|
/plugins
|
|
/optimize
|
|
/built_assets
|
|
/html_docs
|
|
/src/fixtures/vislib/mock_data
|
|
/src/legacy/ui/public/angular-bootstrap
|
|
/src/legacy/ui/public/flot-charts
|
|
/test/fixtures/scenarios
|
|
/src/legacy/core_plugins/console/public/webpackShims
|
|
/src/legacy/core_plugins/console/public/tests/webpackShims
|
|
/src/legacy/ui/public/utils/decode_geo_hash.js
|
|
/src/legacy/core_plugins/timelion/public/webpackShims/jquery.flot.*
|
|
/src/core/lib/kbn_internal_native_observable
|
|
/packages/*/target
|
|
/packages/eslint-config-kibana
|
|
/packages/kbn-es-query/src/kuery/ast/kuery.js
|
|
/packages/kbn-pm/dist
|
|
/packages/kbn-plugin-generator/sao_template/template
|
|
/packages/kbn-ui-framework/dist
|
|
/packages/kbn-ui-framework/doc_site/build
|
|
/packages/kbn-ui-framework/generator-kui/*/templates/
|
|
/x-pack/plugins/maps/public/vendor/**
|
|
/x-pack/coverage
|
|
/x-pack/build
|
|
/x-pack/plugins/**/__tests__/fixtures/**
|
|
/packages/kbn-interpreter/src/common/lib/grammar.js
|
|
/x-pack/plugins/canvas/canvas_plugin
|
|
/x-pack/plugins/canvas/canvas_plugin_src/lib/flot-charts
|
|
/x-pack/plugins/infra/common/graphql/types.ts
|
|
/x-pack/plugins/infra/public/graphql/types.ts
|
|
/x-pack/plugins/infra/server/graphql/types.ts
|
|
**/*.js.snap
|
|
!/.eslintrc.js
|