refactor: replace process.cwd() with ExtensionContext.cwd in coding/web-tools#26
Merged
Conversation
…eb-tools - pi-coding-tools/src/lsp/manager.ts: make root required, remove process.cwd() fallback - pi-coding-tools/src/tools/lsp-tools.ts: getConfig callback takes cwd, passes to loadConfig - pi-coding-tools/src/config.ts: loadConfig requires cwd, removes process.cwd() fallback - pi-coding-tools/index.ts: session_start and createLspTools pass ctx.cwd - pi-web-tools/src/config.ts: loadConfig requires cwd, removes process.cwd() fallback - Sync tests to match new signatures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更背景
之前
pi-coding-tools和pi-web-tools的loadConfig在未传参时回退到process.cwd()。工具execute层已能通过ExtensionContext.cwd获取正确的工作目录,但调用点未传入。变更内容
pi-coding-tools/src/lsp/manager.ts:getClientForFile的root改为必填,删除process.cwd()回退pi-coding-tools/src/tools/lsp-tools.ts:createLspTools的getConfig回调改为接收cwd,传给loadConfig和getClientForFilepi-coding-tools/src/config.ts:loadConfig参数从可选改为必填,移除process.cwd()回退pi-coding-tools/index.ts:session_start事件和createLspTools调用点传入ctx.cwdpi-web-tools/src/config.ts: 同上,移除process.cwd()回退影响范围
仅
pi-coding-tools和pi-web-tools。pi-container-sandbox的process.cwd()使用保持不变(按讨论结果)。验证
npm run typecheck— 全部通过npm run test— 290/290 测试通过