@feng0531/dsh-code-review 0.27.0 → 0.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # 变更记录
2
2
 
3
+ ## 0.27.1
4
+
5
+ - C#候选同名引用判断改一次标识符计数,避免每调用重扫整文件;同名多次保守跳过。
6
+ - 真实Git基线/目标C#自动上下文及定义提示、脏工作副本不泄漏/哈希稳定/status不改,276测试通过。
7
+
3
8
  ## 0.27.0
4
9
 
5
10
  - C#同目录静态零参调用Type.cs必要上下文有界探针,沿用批准路径/changed排除及历史对象查询。
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## 当前状态
6
6
 
7
- 当前代码版本为 0.27.0
7
+ 当前代码版本为 0.27.1
8
8
 
9
9
  C#自动上下文支持窄语法同目录Type.cs静态零参调用探针,需file-scoped namespace且无using/dynamic/注释字符串/同名其他引用;捕获后定义提示再校验命名空间。不是编译器解析,不全仓寻找类型。
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feng0531/dsh-code-review",
3
- "version": "0.27.0",
3
+ "version": "0.27.1",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" },
@@ -12,7 +12,7 @@ export function contextCandidates(files, trackedPaths, {maxCandidates=20,onProbe
12
12
  if(text.includes('/*')||text.includes(String.fromCharCode(96))||text.includes('R"')||/\\\r?\n/.test(text))continue;
13
13
  if(f.path.endsWith('.cs')&&!/["'\x60#]|\/\/|\busing\b|\bdynamic\b/.test(text)){
14
14
  const namespaces=[...text.matchAll(/^\s*namespace\s+([A-Za-z_][A-Za-z0-9_.]*)\s*;\s*$/gm)];
15
- if(namespaces.length===1){const lines=text.split('\n');for(let i=0;i<lines.length;i++){const call=/^\s*(?:await\s+)?([A-Za-z_][A-Za-z0-9_]*)\.([A-Za-z_][A-Za-z0-9_]*)\s*\(\s*\)\s*;\s*$/.exec(lines[i]);if(!call)continue;const token=new RegExp('\\b'+call[1]+'\\b');if(lines.some((line,j)=>j!==i&&token.test(line)))continue;const candidate=path.posix.join(path.posix.dirname(f.path),call[1]+'.cs');onProbe?.([candidate]);add(candidate,f.path,'same-directory-csharp-static-call');}}
15
+ if(namespaces.length===1){const tokens=new Map();for(const match of text.matchAll(/\b[A-Za-z_][A-Za-z0-9_]*\b/g))tokens.set(match[0],(tokens.get(match[0])??0)+1);const lines=text.split('\n');for(let i=0;i<lines.length;i++){const call=/^\s*(?:await\s+)?([A-Za-z_][A-Za-z0-9_]*)\.([A-Za-z_][A-Za-z0-9_]*)\s*\(\s*\)\s*;\s*$/.exec(lines[i]);if(!call)continue;if(tokens.get(call[1])!==1)continue;const candidate=path.posix.join(path.posix.dirname(f.path),call[1]+'.cs');onProbe?.([candidate]);add(candidate,f.path,'same-directory-csharp-static-call');}}
16
16
  }
17
17
  const cpp=/\.(c|cc|cpp|cxx|h|hh|hpp|hxx|shader|hlsl|glsl|cginc|hlsli|compute)$/i.test(f.path),js=/\.(mjs|cjs|js|jsx|ts|tsx)$/i.test(f.path);
18
18
  if(cpp&&/^\s*#\s*(if|ifdef|ifndef|elif|else|define|undef)\b/m.test(text))continue;