CM6: Several questions.

Greetings. Firstly, huge thanks for this great software and for your hard work.

I use CM6 and lang-sql package with basic-setup for my editor. I’ve been digging through referance manual these last days and had some trouble to find info regarding following topics:

  1. lang-sql package with basic-setup offers code folding feature which offers several blocks of code that can be folded. Is there any ability to get those blocks in form of RangeSet or something like this? Context: I’ll need this later to determine the block of code, which user placed his cursor at and highlight the lines within this range);

  2. The fifth version of CodeMirror had sql-hint.js which supported aliases when it came to autocompolete with custom fields (eg. SELECT * FROM table_name alias where alias.column_name), it suggested column name recognizing that alias. However, this doesn’t seem to work out of the box with @codemirror/lang-sql. Is there any way to enable it in this version?

Sorry for several questions in one topic. Thank you in advance for your help.

For looking at the code structure, syntaxTree might be helpful — it gives you the parse tree that is also used as the basis for folding.

The schema option to sql() should provide completing functionality similar to sql-hint.

1 Like