mirror of
https://github.com/github/codeql.git
synced 2026-01-29 14:23:03 +01:00
Merge pull request #119 from jcreedcmu/jcreed/jump-to-def-ide
Add queries for ide search.
This commit is contained in:
@@ -2,3 +2,8 @@
|
||||
- qlpack: codeql-go
|
||||
- apply: lgtm-selectors.yml
|
||||
from: codeql-suite-helpers
|
||||
# These are only for IDE use.
|
||||
- exclude:
|
||||
tags contain:
|
||||
- ide-contextual-queries/local-definitions
|
||||
- ide-contextual-queries/local-references
|
||||
|
||||
19
ql/src/localDefinitions.ql
Normal file
19
ql/src/localDefinitions.ql
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @name Jump-to-definition links
|
||||
* @description Generates use-definition pairs that provide the data
|
||||
* for jump-to-definition in the code viewer.
|
||||
* @kind definitions
|
||||
* @id go/ide-jump-to-definition
|
||||
* @tags ide-contextual-queries/local-definitions
|
||||
*/
|
||||
|
||||
import go
|
||||
|
||||
external string selectedSourceFile();
|
||||
|
||||
cached
|
||||
File getEncodedFile(string name) { result.getAbsolutePath().replaceAll(":", "_") = name }
|
||||
|
||||
from Ident def, Ident use, Entity e
|
||||
where use.uses(e) and def.declares(e) and use.getFile() = getEncodedFile(selectedSourceFile())
|
||||
select use, def, "V"
|
||||
19
ql/src/localReferences.ql
Normal file
19
ql/src/localReferences.ql
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @name Find-references links
|
||||
* @description Generates use-definition pairs that provide the data
|
||||
* for find-references in the code viewer.
|
||||
* @kind definitions
|
||||
* @id go/ide-find-references
|
||||
* @tags ide-contextual-queries/local-references
|
||||
*/
|
||||
|
||||
import go
|
||||
|
||||
external string selectedSourceFile();
|
||||
|
||||
cached
|
||||
File getEncodedFile(string name) { result.getAbsolutePath().replaceAll(":", "_") = name }
|
||||
|
||||
from Ident def, Ident use, Entity e
|
||||
where use.uses(e) and def.declares(e) and def.getFile() = getEncodedFile(selectedSourceFile())
|
||||
select use, def, "V"
|
||||
Reference in New Issue
Block a user