根据配置控制自动格式化功能
- 在onTypeFormattingProvider.ts中添加配置检查,根据squirrel.autoFormatOnType配置项决定是否执行输入时自动格式化 - 在documentFormattingProvider.ts中添加配置检查,根据squirrel.autoFormatOnType配置项决定是否执行文档格式化 - 保持配置项的默认值为false(禁用),用户需主动启用此功能 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
6
dist/providers/documentFormattingProvider.js
vendored
6
dist/providers/documentFormattingProvider.js
vendored
@@ -44,6 +44,12 @@ class DocumentFormattingProvider {
|
||||
* 提供整个文档的代码格式化功能
|
||||
*/
|
||||
async provideDocumentFormattingEdits(document, options, token) {
|
||||
// 检查配置项,如果未启用自动格式化则直接返回
|
||||
const config = vscode.workspace.getConfiguration('squirrel');
|
||||
const autoFormatOnType = config.get('autoFormatOnType', false);
|
||||
if (!autoFormatOnType) {
|
||||
return []; // 自动格式化未启用,返回空数组
|
||||
}
|
||||
const edits = [];
|
||||
try {
|
||||
// 获取文档全文
|
||||
|
||||
Reference in New Issue
Block a user