Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Removing and re-adding database with same folder path does not work properly

未关闭
#836 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
typescript, vscode
领域
devtools

调研方向

从 VS Code 扩展的数据库删除和重新添加流程开始,使用编号的复现步骤来观察陈旧状态。重新创建数据库后复现 codeql-zip-archive 错误,然后验证重新打开源文件和查询结果时不会保留之前数据库的状态。

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

描述

bug VSCode

Version
Extension 1.4.5
CodeQL CLI 2.5.1

Describe the bug
Removing a database after having run queries on it and viewed ASTs and then re-adding a different database at the same file system location (e.g. because you made changes to the source code and then created the database again) prevents browsing the source code of that database.

To Reproduce

  1. Create a folder test-db
  2. In that folder create a Test.java file with this content:
    class Test {
    }
    
  3. Run
    codeql database create --language=java --source-root=. "--command=javac *.java" db
    
  4. In VSCode add the test-db/db folder as database
  5. Run any query, e.g.:
    import java
    
    from Class c
    where c.fromSource()
    select c
    
  6. Click on the result to open the .java source
  7. Run "View AST"
  8. Optional: Close the .java file and remove the AST view and the query result from the list
  9. Use "Remove Database"
  10. Make a change to the Test.java file:
    class Test {
        void someMethod() { }
    }
    
  11. Delete the test-db/db folder and create the database again:
    codeql database create --language=java --source-root=. "--command=javac *.java" db
    
  12. In VSCode add the database again
  13. Run any query again, and click on the result
    ❌ Nothing happens; the CodeQL Query Server output contains:
    Unable to handleMsgFromView: cannot open codeql-zip-archive://1-51/#REDACTED#%5Ctest-db%5Cdb%5Csrc.zip/#REDACTED#/test-db/Test.java. Detail: Unable to read file 'codeql-zip-archive://1-51/#REDACTED#\test-db\db\src.zip/#REDACTED#/test-db/Test.java' (Error: unexpected end of file)
    
    Similarly, clicking on the Test.java source file in the files explorer of VSCode causes a similar error.

Note: Steps 5 - 8 (inclusive) might not be needed to reproduce this.

Expected behavior
When re-adding a database for which a database with the same folder path existed previously, all state of that previous database should be removed.

Removal of previous database state could happen either when the database is removed, or when a database with the same folder path is re-added. Maybe it would be better to only perform this when re-adding the database (instead of on removal) to allow the user to still view some information after the database has been removed (might be useful when importing test databases).

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

贡献指南

打开贡献指南

从这里开始

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

github/vscode-codeql 的其他 Issue

查看 github/vscode-codeql 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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