-
Notifications
You must be signed in to change notification settings - Fork 364
-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Analyzer plugin for .moor files #150
Comments
I've started some work on an analyzer plugin that lives in the Syntax highlightingUnfortunately, VS Code plugins can't provide dynamic syntax highlighting. They need to provide a static grammar to VS Code, so the Dart plugin can't use the moor analysis plugin for that. I looks like the IntelliJ plugin can the analysis server for highlighting, so maybe we have more luck there. ErrorsWe send both parsing and semantic lints, warnings and errors to the analysis server. Of course, this isn't nearly as helpful as syntax highlighting, but users would get a realtime feedback on invalid queries. Navigation and occurrencesTo reduce complexity, I think it makes sense to first restrict this to sql in moor files only (so you could ctrl + click on a column name inside a query and jump to its definition). As long as the reference appears inside a moor file (and say the column is declared in a Dart file), there shouldn't be problems. Unfortunately, if a plugin sends a navigation event that is different from the Dart analyzer, the analyzer will take priority. So I'm not sure if we can find references to generated methods and "re-route" them to the moor file - the analyzer would probably veto those and link to the AutocompleteI've started some very basic work on this already. Given that we already have a parser, we can use that parsing logic to report an auto-complete option at a specific location. Of course, suggestions that depend on the context (e.g. column names, import files, etc.) would need special work. Folding and outlineThis is arguably least spectacular feature, but at least it's already implemented. We provide information that lets editors collapse some definitions (like the column declarations in a |
With some slight modifications of the Dart extension to VS Code, we can get outline, folding and errors: Syntax highlighting is blocked by VS Code, but we should be able to get auto-complete, quickfixes and navigation (inside moor files) working. |
Closing this as the prototype has landed in a stable release. Additions should be tracked in other issues. |
I discovered a decent workaround for IntelliJ users, but it requires Ultimate edition to have access to the "Database tools and SQL" plugin. void main() {
test('create db', () async {
Database db = Database.withExecutor(VmDatabase(File('todos.sqlite3')));
await db.categoriesWithCount().first;
});
} |
(I didn't see an existing issue for the analyzer plugin so feel free to move this as you see fit).
Navigation and syntax highlighting are the first features I'd personally see as most valuable. Being able to ctrl+click on generated dart methods and jump to the .moor file method and vice versa would be so cool - although I get the feeling that's probably the most challenging/complex feature!
Originally posted by @Mike278 in #142 (comment)
The text was updated successfully, but these errors were encountered: