Giter Club home page Giter Club logo

vscode-codeql's Introduction

CodeQL for Visual Studio Code

This project is an extension for Visual Studio Code that adds rich language support for CodeQL. It's used to find problems in code bases using CodeQL. It's written primarily in TypeScript.

The extension is released. You can download it from the Visual Studio Marketplace.

To see what has changed in the last few versions of the extension, see the Changelog.

CI status badge VS Marketplace badge

Features

  • Enables you to use CodeQL to query databases and discover problems in codebases.
  • Shows the flow of data through the results of path queries, which is essential for triaging security results.
  • Provides an easy way to run queries from the large, open source repository of CodeQL security queries.
  • Adds IntelliSense to support you writing and editing your own CodeQL query and library files.
  • Supports you running CodeQL queries against thousands of repositories on GitHub using multi-repository variant analysis.

Project goals and scope

This project will track new feature development in CodeQL and, whenever appropriate, bring that functionality to the Visual Studio Code experience.

Contributing

This project welcomes contributions. See CONTRIBUTING.md for details on how to build, install, and contribute.

License

The CodeQL extension for Visual Studio Code is licensed under the MIT License. The version of CodeQL used by the CodeQL extension is subject to the CodeQL Research Terms & Conditions.

When using the GitHub logos, be sure to follow the GitHub logo guidelines.

vscode-codeql's People

Contributors

adityasharad avatar aeisenberg avatar alexet avatar angelapwen avatar asger-semmle avatar asgerf avatar bmuskalla avatar charisk avatar dbartol avatar dependabot[bot] avatar edoardopirovano avatar elenatanasoiu avatar eysk-io avatar ginsbach avatar github-actions[bot] avatar henrymercer avatar jarlob avatar jcreedcmu avatar kaspersv avatar koesie10 avatar marcnjaramillo avatar marcono1234 avatar mgsium avatar norascheuch avatar rasmuswl avatar robertbrignull avatar sampart avatar shati-patel avatar starcke avatar tjgurwara99 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-codeql's Issues

Improve navigation from source code to test

Is your feature request related to a problem? Please describe.
I find myself using the CLI test runner, as navigating in the test ui to the test I am working on is quite a hassle, it is too slow.

Describe the solution you'd like
Some way to
a1) jump from a source code that is test file to the test runner
a2) Have an auto-navigation mode from active file to the test tree (like in the file system view, where an open editor immediately opens the tree and selects the currently opened file)
b) A button exectute tests immediately from the file system view, like the "Run Query" command

Bug: Error when trying to open query log file (on Windows)

Describe the bug

The right-click query history option Show Query Log doesn't work for me. I get the following error:

Could not open log file c:\Users\Shati Patel\AppData\Roaming\Code\User\workspaceStorage\f69b706cc42093b6075931e719082fad\GitHub.vscode-codeql\CodeQL Query Server\query-test.ql-1.log
cannot open c:%5CUsers%5CShati%20Patel%5CAppData%5CRoaming%5CCode%5CUser%5CworkspaceStorage%5Cf69b706cc42093b6075931e719082fad%5CGitHub.vscode-codeql%5CCodeQL%20Query%20Server%5Cquery-test.ql-1.log. Detail: resource is not available
Error: cannot open c:%5CUsers%5CShati%20Patel%5CAppData%5CRoaming%5CCode%5CUser%5CworkspaceStorage%5Cf69b706cc42093b6075931e719082fad%5CGitHub.vscode-codeql%5CCodeQL%20Query%20Server%5Cquery-test.ql-1.log. Detail: resource is not available
    at file:///C:/Users/Shati Patel/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:4156:737
    at processTicksAndRejections (internal/process/task_queues.js:85:5)

Additional context

Running v.1.1.1 of the extension on Windows.

User should be able to generate a database from the current workspace

There is no easy way for a user to create a database locally if the only version of the cli installed is the default extension's version. The reason is that there is no easy way for a user to determine the file system path to the executable.

Instead, the extension should offer a mechanism to generate a database from the current workspace.

My idea is this:

  1. User executes the CodeQL: Create database from workspace command
  2. vscode opens an input box to request the language of the database
  3. the cli invokes the database create command with the given language and placed in a well-known location (perhaps specified in configuration)
  4. After creating the database, it is automatically imported into the workspace

Open questions:

  1. How do we handle database updating? Perhaps there is another command that the user needs to run and it is done manually? Perhaps it can be performed in the background on a schedule?
  2. How do we add the appropriate ql packs so that the user can run queries? Can we download them and import into the project?

See https://github.com/orgs/github/teams/codeql-core/discussions/1 for a longer discussion on this.

Adding workspace folder for source archive fails during remote development

Describe the bug
When using remote development via the Remote-SSH extension, and adding a database with a zipped source archive to an open workspace/folder, VS Code shows an error and fails to add the source archive as a new workspace folder.

Error notification:

Extension 'CodeQL' failed to update workspace folders. Error: Workspace folders from different providers are not allowed in the same workspace.

To Reproduce

  • Install VS Code on a local machine (I'm using 1.42 on macOS catalina).
  • Install Remote - SSH and CodeQL extensions (extension 1.0.6, CLI 2.0.4).
  • Command Palette > Remote-SSH: Connect to Host, then connect to a remote VM (I'm using Ubuntu 18.04).
  • On the remote VM, create a parent directory, with a ql checkout as a child directory, and at least one child directory for custom queries.
  • On the remote VM, create or place a CodeQL database with a zipped source archive.
  • Open Folder > choose the parent folder on the remote machine.
  • Add a CodeQL database from the Databases view, and select the database on the remote VM.

Expected behavior
The source archive should be added as a remote workspace folder (since it is also on the remote machine).

Sorting doesn't work on result set `#select`

If the user tries to change the sort order on a column of result set #select, the cli command succeeds, but then we try to load the bqrs file
vscode-resource://file///tmp/queries_32264YgpJhLjEyJiL/sortedResults0-%23select.bqrs
where note %23 is the urlencoded version of #. Either we need to double-escape the %, or there's something fishy going on with vscode-resource url translation upstream.

[Error]: Unable to install CodeQL CLI. Error: FILE_ENDED

Describe the bug
Fails to download database for CodeQL and throws the below error on vscode.

"Unable to install CodeQL CLI. Error: FILE_ENDED

To Reproduce
Click on + button and install database.

Expected behavior
It should have downloaded the database

Additional context
Add any other context about the problem here.

Improve database management in the UI

Is your feature request related to a problem? Please describe.

  • When I have multiple CodeQL databases open in the Databases tree view in the workspace, it is difficult to organise them, rename them, or see where they live on the filesystem.
  • This is particularly frustrating if I have multiple databases for the same project but different target languages that were all downloaded from an LGTM instance: by default, the name of the database directory is always projectname_sha, which makes them impossible to distinguish by language. The current workaround is to remove them from the workspace, rename them on the filesystem, and re-add them.

Describe the solution you'd like

  • For any database in the workspace, I can navigate to its filesystem location using a command in the right-click or Command Palette menus (similar to Open Containing Folder in the Explorer view).
  • For any database in the workspace, I can rename or annotate the database name in the UI. (I don't have a strong preference about whether this should also rename the folder on the filesystem.)
  • Databases in the UI have a marker telling me the target language.
  • I can sort the list of databases in the UI alphabetically or chronologically.

Describe alternatives you've considered
Current workaround is manual renaming, which is clunky once the user has already imported the database.

Additional context
This is quite a large set of suggestions under a single theme: happy to split it up.

Accept minor-version bumps for the CLI

Currently the extension insists on the CLI being version 2.0.x specifically.

From the CLI development side I'd like to maintain the option to bump the minor version to 2.1.x at some point, which would be kept backwards compatible. Reasons for this could either be new features that we think deserve some fanfare, or as a tool for managing the rather complex multi-stakeholder release cycle of the CLI.

I think the extension should accept 2.x.x versions in general, possibly with a lower bound if it depends on features added after 2.0.0.

Improve UI feedback when there are 0 `alerts`

Is your feature request related to a problem? Please describe.
While developing and running a query, it is possible to have 0 results in the formatted alerts table, but a non-zero number of tuples in the #select table. This can happen if the selected entity is missing location information, or if there is a mismatch between the query metadata and the columns in the select clause. This commonly trips up both new and experienced writers and leads to time wasted debugging the query's logic.

Describe the solution you'd like

  • Make it obvious to the user how many results are in each of the result tables, regardless of which result table is currently being displayed in full.
  • Suggest the user checks the query metadata/result patterns if there is a mismatch with 0 alerts.

Describe alternatives you've considered
Alternatively, make 0 alerts a special case, and in this case have an annotation pointing the user to the #select table or the table dropdown.

Additional context

Text in interpreted results view header appears to have slightly different vertical alignment

Describe the bug
The various bits of text in the interpreted results view header appear to have very slightly different vertical alignments:

image

Here, the text on the right hand side is the lowest, followed by the text on the right hand side, followed by the text in the centre.

To Reproduce
Run a path query, view the query results, and select "alerts" from the dropdown to view the interpreted results.

Expected behavior
The text in the screenshot should have the same vertical alignment.

Hide empty test directories in QL test view

Steps to reproduce:

Open a new workspace folder with qlpack.yml file like

name: user/my-custom-queries
version: 1.0.0
libraryPathDependencies: ["codeql-cpp"]  

Do Add workspace folder and choose the top-level ql library directory. Select any cpp database. Run command CodeQL: Quick Query to create a quick query buffer, but you needn't edit it or run it. Go to the test panel.

Expect: just one top-level directory of tests, for ql.
Actual: three top-level directories, one for ql, one for the original workspace folder, one for Quick Query's synthetic directory.
image

Alternatively, maybe we can make a special case to hide Quick Query since it will never have qltest files, and leave the external-to-ql workspace folder as visible but empty, since maybe the user might put qltest files there, in which case it would be visible and nonempty.

Fix dependency of queryserver client on compiled code

Make a version of the interface DisposableObject that doesn't pull in arbitrary extra runtime code from vscode, to eliminate dependency of queryserver-client.ts on 'semmle-vscode-utils/out/disposable-object', while allowing unit tests to pass. See conversation on #173 for more details.

Extension fails to realise that database needs to be upgraded

Steps to reproduce:

  1. Download any JavaScript database from LGTM.com, import it into VSCode
  2. Open a version of https://github.com/Semmle/ql that includes github/codeql#2252; this PR introduces a dbscheme change that isn't on LGTM.com yet
  3. Try running a JavaScript query

The query fails to run, and opening the Query Server log reveals that this is due to a dbscheme mismatch, yet the dialog for automatically upgrading the database before running the query does not appear. Manually upgrading the database fixes the problem.

(This is the underlying bug causing github/codeql#2354.)

In test diffs, compare the result to an empty file if no .expected file exists

Is your feature request related to a problem? Please describe.
After creating a new test (with source and query, but no .expected file) and running a test through the test explorer, the "show test output differences" menu item fails with Error: unable to resolve non-existing file.

Describe the solution you'd like
The "Show test output differences" menu item opens a diff window in which the .actual file is compared to an empty file. It might also display a warning message.

Describe alternatives you've considered
The menu item could instead open the .actual file itself, possibly while displaying a warning message.

Timeout during query compilation should produce failed query history item

Describe the bug
When query compilation times out, the message The request (id: 6, method: 'compilation/compileQuery') has been cancelled is added to the extension log, but a query history item corresponding to the timed out query is not added to the query history view.

To Reproduce

  1. Set codeQL.runningQueries.timeout to 1 second
  2. Run a long-running query e.g. a path problem query
  3. Focus the query history view
  4. Observe that the query history view doesn't contain an item corresponding to the timed-out compilation.

Expected behavior
The query history view should contain an item corresponding to the timed-out compilation with a failed icon and the status "timed out".

Report error when choosing a folder that isn't a database.

To Reproduce
Go to the explorer and right-click on a folder that is not a database, and choose CodeQL: Set Current Database. Nothing happens.

Expected behavior
There should be a message communicating to the user that this isn't a database.

Additional context
Making the context menu only appear when the directory is a database in the first place would be desirable, but I don't know if it's possible. The current "when" condition for the command is
"when": "resourceScheme == codeql-zip-archive || explorerResourceIsFolder" and I can't find any refinements of explorerResourceIsFolder.

Negative integers are returned as unsigned integers

According to the documentation, int is "The primitive type of integers, represented with 32 bits using two's complement". However, the VS Code extension returns 4294967295 (instead of -1) for the following queries, among other similar expressions:

from int x
where x = -1
select x
select -1

screenshot-uint-ql

Changing from a light theme to a dark theme does not update selected database icon

Describe the bug
When the current theme in VS Code is changed from a light theme to a dark theme, the icon used for the selected database remains as the light theme icon. It should instead change to the dark theme icon.

To Reproduce

  1. Select a light theme in VS Code
  2. Reload the current VS Code window
  3. Select a database
  4. Observe that the light theme "database selected" icon appears next to the database
  5. Change the current theme in VS Code to a dark theme
  6. Observe that the icon next to the database is still the light theme icon.

Expected behavior
After step 5 above, the database selected icon should be updated to the dark theme icon.

Inconsistent source code highlighting

Hi,
in the screenshot below it can be seen that the code highlighting is inconsistent.
In particular, the first occurrences of "query", "a" and "b" in the QL code are in the wrong colour.

2019-12-04-200621_1020x331_scrot
Although the image was taken a private branch, the issue is reproducible with current master and version 1.0.1 of the CodeQL plugin.

Provide basic XML syntax highlighting for qhelp files

Problem
As a developer it would be nice to have basic syntax highlighting support for qhelp files.
Currently qhelp files are displayed as plain text and look rather dull ;)
Also there's no help for finding out which tags belong together.

Proposed solution
Since qhelp files are basically XML files interpreting them as XML files would be a low hanging fruit.
This would not automatically XML validation support as VS code does not support XML validation out of the box.

Describe alternatives you've considered
An alternative would be to use a different VSCode grammar set that restricts the set of tags that can be used. However, I think that would be a better candidate for XML validation.

Additional context
I will create a small pull request for this issue.
The Pull request instructions instructed me that issues need to be created for any UI or other user-facing changes, so I created this one.

ESC key closes current running query notification

Is your feature request related to a problem? Please describe.
When pressing the escape key to get rid of an error notifications (i.e. a syntax error from trying to execute a query with a typo), all notifications are closed.
If I start another query run before pressing ESC, the (valuable) notification containing the query progress also vanishes, along with the cancel button.
However the query is still executed in the background.

Describe the solution you'd like
Pressing ESC once should not close a notification that provides information about a running query.
If possible, pressing ESC twice could close that notification as well.

Describe alternatives you've considered
None

Show more information in query history view for Quick Eval

For quick query, we store (and show on demand) the exact entire query that was ran.

For ordinary queries, showing the text of the query might be confusing because the state of the libraries it depended on might have changed in the meantime.

For quick eval, there is nonetheless a piece of information that is relevant to show, but not so large that it is likely to confuse the user into thinking that that's all of the relevant information: the context of the token or line that quick eval was applied to. We could show this in the query history status line.

It appears that there is an issue resolving source archive's path when using network path

Describe the bug
Source archive's path appears to not have been resolved properly.

My database is stored on a network folder (\x.x.x.x\a\b\c\database) and when I add the database to vs code, Explorer shows that source archive could not be resolved. When I look at the path it is pointing to, it is actually \a\b\c\database\src.zip\ instead.

To Reproduce

  1. Database on a network folder (\x.x.x.x\a\b\c\database)
  2. Add database to vs code

Expected behavior
Source archive could not be resolved (\a\b\c\database\src.zip)

Additional context
To help troubleshoot, the version of VS code that I am using is 1.41.1 and the version of CodeQL extension that I am using is 1.0.4.

There are no issues with running queries and display the results.

Deprecate `codeql.cmd` on windows

The extension has moved away from calling codeql.cmd in the cli. Instead, it calls codeql.exe by default. Eventually, the cmd file will be removed from the cli. However, there are some caveats we still need to handle:

  1. User has an old version of cli installed that does not have codeql.exe available.
  2. User has explicitly specified codeql.cmd as their executable path.

For 1, we should display a warning and suggestion to upgrade and fall back to the cmd file. For 2, we again display a warning, but use it anyway.

Selecting a different DB doesn't release the cache directory lock on the original DB

Describe the bug
Selecting a new DB doesn't release the cache directory lock on the originally selected DB, causing query runs on the originally selected DB from the CLI to fail.

To Reproduce

  1. Add two databases, database A and database B to the databases view in the CodeQL extension using the "+" button
  2. Select database A
  3. Run a query on database A
  4. Select database B
  5. Using the CodeQL CLI run a query on database A
  6. Observe that database A is still locked:

    A fatal error occurred: Error initializing the IMB disk cache: the cache directory is already locked by another running process. Only one instance of the IMB can access a cache directory at a time. The lock file is located at /Users/henry/databases/ppppbn_boardgame_ff33297/db-javascript/default/cache/.lock (eventual cause: OverlappingFileLockException)

Expected behavior
Selecting database B should unlock the cache directory of database A, so that the query from the CLI succeeds.

Additional context
The cache directory of database A will be unlocked when a query is run from the extension on database B.

Quick evaluation in `.qll` files fails

Describe the bug

Quick-evaluating an expression in a .qll file fails with 'The selected resource is not a CodeQL query file; It should have the extension ".ql".' It works in a .ql file.

To Reproduce
Steps to reproduce the behavior:

  1. Select a JavaScript database
  2. Open the JavaScript library Expr.qll from latest master on Semmle/ql (any other .qll file should work as well)
  3. Try to quick-evaluate the predicate ExprOrType::getEnclosingStmt
  4. Get an error saying 'The selected resource is not a CodeQL query file; It should have the extension ".ql".'

The above reproduction steps use JavaScript as an example, but the same happens in other languages.

Expected behavior
The expression should be evaluated.

Environment (please complete the following information):

  • OS: Linux (Ubuntu 18.04.4)
  • Version: CodeQL 1.1.0

Additional context
This problem seems to be new in CodeQL 1.1.0.

"ERROR: The selection is not a valid quick-eval target" for classes

Hi,

when quick-evaluating the name of a class in a class definition, I get the error

Quick evaluation compilation failed:
ERROR: The selection is not a valid quick-eval target. (/home/qldev/build/ql/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll:648:19:648:19)

When evaluating the predicate with the name of the class, I get meaningful results.
Maybe it would be a good idea to redirect from the class definition to the defining predicate when using quick-eval?

No syntax highlighting for `unique` aggregate

Describe the bug
The QL text unique is highlighted as a predicate or variable name, not a keyword

To Reproduce
Open a query that uses the unique aggregate in the editor.

Expected behavior
The unique identifier is highlighted as a keyword.

Additional context
OK, unique is technically not a keyword, since it's context-sensitive, but it should look like one when used as an aggregate name.

Support sorting for interpreted alerts

At the moment it is possible to sort results by each column in the #select view. However the interpreted alerts is very useful and could also benefit for some similar dynamic sorting for better exploration of the results..

Would it be possible to add some "sorting" columns to the #alerts view? I'm not sure exactly what this would like but the idea would be to keep the clean and readable look of interpreted alerts while also having a way to re-arrange their order (maybe a "sort by" dropdown with all the variables in the select clause as options?)

Showing log associated to query should work for large query logs

@tausbn reported being unable to view ~448M query log file from the query history, with the only message being that arising from

helpers.showAndLogErrorMessage(`Could not open log file ${queryHistoryItem.logFileLocation}`);

in query-history.ts. He says when he tried to open the same file manually, it worked. We should probably at least log the exception being handled, and if possible, show the log in some way, even if it's without syntax highlighting.

Quick evaluation: Column order in query results

Hi,

when using Quick Evaluation on a predicate in the VSCode CodeQL editor, the query results window shows the resulting columns not in the order of the predicate parameters.
It seems that the first two parameters are swapped in the query results, and then following parameters are listed in-order.

Using Run Query on a QL file seems to produce in-order results.

Updating CodeQL CLI hangs loading the workspace tree

Describe the bug
When I load VS Code, and there's an update to the CodeQL CLI available, the CLI is automatically downloaded. However, VS Code will not load my workspace tree whilst the CLI is downloading (it's simply blank).

It seems like we're doing the CLI update in some sort of initialization handler which is preventing the workspace tree from loading.

To Reproduce
Open VS Code after CodeQL CLI has been updated.

Expected behavior
Workspace tree should be available while new CodeQL CLI is downloading.

New tests not discovered within the current workspace without restart

Describe the bug
When a new CodeQL test case/directory is added within an existing workspace, it is not visible in the Test Explorer until the workspace is closed and reopened.

To Reproduce

  1. Add a workspace folder with existing test cases, e.g. a checkout of Semmle/ql
  2. Duplicate a directory of test cases, e.g. copy ql/java/ql/test/dataflow/taint-ioutils to ql/java/ql/test/dataflow/taint-ioutils2.
  3. Go to the Test Explorer view. The new test directory is not visible in the UI, and so cannot be run on its own. However, running the tests in a parent directory will pick up the new test cases.

Expected behavior
The new test directory is visible in the Test Explorer UI, and can be run directly.

Additional context
CodeQL for VS Code 1.1.1, Test Explorer UI 2.17.0, VS Code 1.42.1.

Focused sidebar is changed when query execution finishes

When the execution of the query finishes, the sidebar focus changes to the CodeQL sidebar. This change of focus can interrupt user workflows such as entering a commit message on the source control sidebar. Instead, the sidebar focus should be maintained when query execution finishes.

regexp based narrowing in ql results colums

Is your feature request related to a problem? Please describe.
When triaging large sets of findings not being able to narrow the finding set down to a specific area of the results listing requires you to edit and re-run your queries to e.g. match a specific file or case, this is time consuming and interrupts more general code assessment workflows a bit.

Describe the solution you'd like
Add a regexp based result narrower to ql results columns. Ideally this narrower is easily accessible and allows for rapid narrowing and un-narrowing of results listings.

e.g. if I have 5000 findings and 300 of those findings are in bla.c I'd like to go "bla.c." and have the results listing narrowed to those 300 findings.

Describe alternatives you've considered
Manual editing and then rerunning the actual query to narrow.

Additional context
N/A

Incorrect behaviour when operation on databases that are replaced on-disk

Describe the bug
I often use the VScode extension to run queries on databases produced by codeql test run.
If I run a query on a database, then run codeql test run, and then run another queries I get "Severe disk cache trouble (corruption or out of space)" exceptions.

To Reproduce

  1. add database generated by codeql test run to the VScode extension, run a query on it.
  2. Execute codeql test run again.
  3. Execute query again

Expected behavior
Second query should execute on the new database without exception

vscode ql result navigation improvements: lingering selected result highlight, keyboard based result navitation

Is your feature request related to a problem? Please describe.
When navigating large results for birds-eye assessment/triage of findings, it is a bit frustrating to click on a QL result in vscode, jump into the code nagivation pane, and then lose your place in the QL selection list.

Additionally, the workflow for navigating the results would be a bit more smooth if you could navigate up/down the the result list with e.g. the arrow keys.

Describe the solution you'd like
If possible, keep a lingering highlight of the last selected QL result in the QL results pane.

If possible, make it so that when in the result pane, you can navigate up/down the list with a keyboard shortcut, ideally when navigating results, the code pane updates with the selected result without switching focus, so you can walk the results and do rapid review of large sets of findings.

Describe alternatives you've considered
N/A

Additional context
N/A

Timeout during query compilation or query evaluation should produce notification

Describe the bug
If a query compilation or a query evaluation times out, the extension should produce a notification to inform the user of the timeout.

To Reproduce

  1. Set codeQL.runningQueries.timeout to 1 second
  2. Run a long-running query e.g. a path problem query
  3. Observe that the query run notification disappears, indicating that the query run has terminated, however there is no notification informing the user of the timeout.

Expected behavior
When the query run notification disappears, an error notification should be displayed indicating that the query run has timed out.

Autocomplete improvements

If I'm typing some QL, and the last characters I wrote were and or or, then the autocomplete pops up with a list of candidate predicates and classes containing the respective characters.

This is quite tiring. A few suggested fixes:

  • Ensure that and or or is the top autocomplete item
  • Suppress the autocomplete box if the token is and or or (or indeed any other keyword?)
  • Make autocomplete context aware. For example,
    • if the completion requires a logic operation, do not populate autocomplete with predicates or classes
    • if the completion requires a predicate or variable, only populate autocomplete with variables and predicates
    • if the completion requires a class name, only populate autocomplete with class names or types.

A few suggestions for making autocomplete context aware:

  • Use the parse tree. This probably won't work since the QL parser is dreadful at error recovery.
  • If the preceding token is a ( or a ,, only populate type names
  • If the preceding token is {, |, =, and or or, only populate predicate names or quantifiers (exists etc).
  • If the preceding token is a variable name, or a ), only populate logic keywords
  • If the preceding token is ., ideally use the type to guide autocomplete. If not, autocomplete using predicate names.
  • Otherwise, autocomplete using all things (predicates & types etc).

I'm sure these rules are incomplete, and will need further refinement, but I hope you get the idea.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.