question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

behavior of example content_assist

See original GitHub issue

hi! my goal is implementing auto-completion for existing language. i’m tring it with simplified sample (fake) grammar, using chevrotain/examples/parser/content_assist as reference.

but it seems that example can’t handle my scenario well 😦

my sample grammar is,

// NL token is NewLine.
// _  token is WhiteSpace.

startRule -> 
  NL? stmt (NL stmt)* NL?

stmt -> 
    functionStmt
  | enumStmt
  | declareStmt

functionStmt -> 
  (visibility _)? (STATIC _)? FUNCTION _ IDENTIFIER

enumStmt -> 
  (visibility _)? (STATIC _)? ENUM _ IDENTIFIER

declareStmt ->
  (visibility _)? DECLARE _ IDENTIFIER

visibility -> 
  PRIVATE | PUBLIC

my expected behavior is,

input candidates(next possible tokens)
Private, Public, Static, Function, Enum, Declare
Private Static, Function, Enum, Declare
Private Static Function, Enum

please see my code on gist. https://gist.github.com/ayapi/e29c9982aacd0ca3f03b3b83e6c642e4

i cant get expected candidates because, maybe, before consume token, before settle rule, at these position, in parser internally.

is it possible?? i want to realize it somehow or other. actually, i’ve never seen parsing library that can handles well it easily. nearley stores all next probable tokens to table row, so i just have to collect them, but nearley has other issues(slow, hard to get rulestack/tree on error, etc…)). if it can be solved by chevrotain, chevrotain will be best-solution.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
bd82commented, Oct 24, 2016

I’m working on a different approach which will (hopefully) be built into Chevrotain as a first class feature.

You can keep track on my progress here: https://github.com/SAP/chevrotain/issues/291

0reactions
bd82commented, Nov 1, 2016

Great 😄.

And if you can share the grammar you are working on (link/access/…) I will review it, as it is useful both ways:

  • Feedback to Chevrotain --> How do people actually use the library.
  • Feedback to Grammar authors --> access to tips/tricks/best practices that are not always documented.

I will close this issue as the original problem was resolved. Additional feedback is always appreciated 👍 so new issues are very welcome.

Read more comments on GitHub >

github_iconTop Results From Across the Web

behavior of example content_assist · Issue #290 · Chevrotain ...
hi! my goal is implementing auto-completion for existing language. i'm tring it with simplified sample (fake) grammar,
Read more >
Changing the behavior of the Eclipse auto-complete (Content ...
FYI, in Eclipse terminology this feature is called Content Assist. Is there any way to make the suggestions box visible all the time,...
Read more >
Content assist
Content assist behavior is defined in the interface IContentAssistant. Setting up a content assistant is somewhat similar to setting up syntax highlighting.
Read more >
TMF (Xtext) » XBASE content assist inconsistent behavior
package org.xtext.example.mydsl.ui.contentassist ... What kind of behaviour should i expect within XBase expresions?
Read more >
Tips and Tricks (JDT) - IBM
Content assist, Content assist provides you with a list of suggested completions for partially entered strings. In the Java editor press Ctrl+Space or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found