CodeQue - Multiline Structural Search for Visual Studio Code
CodeQue is code search engine that understands the code syntax.
It matches structure rather than plain text, which makes it very effective for complex queries.
VSCode extension aims to improve code search experience.
Advanced search options and todo-like list of accurate search results makes it your new super power.
It's one of the tools in the ecosystem. There is also CLI tool and ESLint plugin coming soon.
More languages will be added once it will get traction.
Watch extension in action (external link) 👇
Benefits of using CodeQue VSCode extension
CodeQue is more than just a search tool - it's a refactoring tool as well.
It addresses the problems of standard search by providing multiline support and an easy way to add gaps or use wildcards into the query.
You don't need to have any knowledge of Regular Expressions to query complex code patterns.
It helps developers with code refactoring, speeds up project discovery, and makes it easy to find duplicated or similar code. patterns.
With CodeQue, you can easily navigate and modify your codebase, making your development process faster and more efficient.
One of the main strengths of CodeQue is its easy-to-use query language, but it also offers several additional features that make it a great support tool for your daily work.
The beauty of CodeQue query language is that the query has to be valid source code. You don't have to learn anything new!
Except the fact there are a few types of wildcards.
It matches all identifiers, JSX identifiers, types identifiers, function names and so on.
It matches any statement or expression. Think of it as 'match anything'. There a few quirks there. It's good to have general understanding of how code is represented in AST (Abstract Syntax Tree) for more complex queries.
Wildcards in strings
Strings have their's own wildcards
Here is an example of query which finds all types of logs which includes word
CodeQue offers the following search modes
The most useful mode is `include`. As the name suggest the matched code has to include the code from query, but it can also contain other statements. It performs structural comparison.
Sometimes you might want to find the code that matches exactly your query. Here is where
Last but not least,
Here is the example of
Searching by file imports
Cool feature of CodeQue is ability to search within files that are directly and indirectly imported by given entry point. CodeQue generates file's dependency tree and search through all nodes. Simply file dependency based search.
It's handy for finding whether a given module is used in given part of application or find a code causing a bug when proper stack trace is not available.
To get started you can enter the file path manually in search settings.
However easier way of searching by file imports is to use option
Todo-like results list
Ability to manage search results list is very handy for refactoring. You can collapse or remove not relevant results and mark others as done after you make changes. I've very similar UX to Github Pull Request review view.
Select to search
Another handy addition is the possibility to search by code selected in editor, so you don't have to copy-paste the query. It's just faster.
After making a selection simply click
CodeQue will automatically detect whether select text is valid code and perform search using recently used structural search mode. Otherwise it would fallback to
Files list filters
Search wouldn't be useful without ability to filter files list.
You can define glob patters to either include or exclude files from the list.
By default CodeQue is not searching in files ignored by
Enable the following flags with caution, as they might significantly downgrade search performance for lager projects.
Example files list settings 👇
You can choose whether to compare identifier persisting their original case or do case insensitive match.
Sometimes you might encounter some search errors. They will be mostly due to some syntax errors in you source files.
You can check search error details in tooltip available after click the error count message 👇
CodeQue is general purpose search tool. The examples list could be endless. Here are some of them for you to get a glimpse of what's possible. Those are relatively simple, you definitely would find some more complex during day to day work.
All usages of