Add ability to use contextual queries to find references when already on a reference

未关闭 适合新手
#592 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
停滞
技术栈
typescript
领域
devtools

调研方向

从 extensions/ql-vscode/src/contextual/templateProvider.ts 的第 70 行开始,这里会根据选定的位置筛选结果。跟踪 contextual find-references 如何为声明和引用生成结果。完成的标准是:在 Java 源文件中选择一个引用时,找到的引用与选择其声明时相同,同时声明行为保持不变。

由索引模型根据 Issue 内容生成。

描述

bug enhancement VSCode

I'm not exactly sure whether this is a feature request or a bug report. Regardless, this is behaviour that is not implemented, but I would expect it to be.

When running the find references contextual query, on a token in a database source file, no references will be found if the token represents a reference itself. References will only be found if the selected token is a declaration. For instance:

int /* 1 */ myMethod() {
  /* 2 */ myMethod();
  /* 3 */ myMethod();
}

If you place the caret at 2 or 3, no references will be found. If you place the caret at 1 References will be found at 2 and 3. Most other language servers will find references for 2 and 3 regardless of which reference is selected.

The problem is not related to the queries themselves. Rather, it happens here:
https://github.com/aeisenberg/vscode-codeql/blob/353a87de12ca818293aeb3199d057a23a24cc403/extensions/ql-vscode/src/contextual/templateProvider.ts#L70-L70

This function will take all possible results and filter out results that do not contain the selected position. This makes sense when the selected position is the declaration, but it does not make sense if the position is a reference.

主要语言
TypeScript
星标
539
派生
240
平均合并
2 天 6 小时
30 天内合并 PR
29

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

github/vscode-codeql 的其他 Issue

查看 github/vscode-codeql 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。