astral-sh / ruff-vscode

A Visual Studio Code extension with support for the Ruff linter.
Other
1.12k stars 53 forks source link

Executing the ruff command once for each character entered? #334

Closed FlatMapIO closed 1 year ago

FlatMapIO commented 1 year ago

I checked the log of the ruff extension, and I found that it outputs a full formatted log every time I type a character in the Editor. Of course, it doesn't actually format my code, and if it did, it would seem extremely unreasonable.


'--output-format', 'json', '-', '--stdin-filename', '/home/sa/Workspace/mPLUG-Owl/test.py']
2023-11-09 13:05:23.778 [info] Using interpreter executable: /home/linuxbrew/.linuxbrew/bin/ruff
2023-11-09 13:05:23.778 [info] Found ruff 0.1.4 at /home/linuxbrew/.linuxbrew/bin/ruff
2023-11-09 13:05:23.778 [info] Running Ruff with: /home/linuxbrew/.linuxbrew/bin/ruff ['--force-exclude', '--no-cache', '--no-fix', '--quiet', '--output-format', 'json', '-', '--stdin-filename', '/home/sa/Workspace/mPLUG-Owl/test.py']
2023-11-09 13:05:31.499 [info] Using interpreter executable: /home/linuxbrew/.linuxbrew/bin/ruff
2023-11-09 13:05:31.501 [info] Found ruff 0.1.4 at /home/linuxbrew/.linuxbrew/bin/ruff
2023-11-09 13:05:31.501 [info] Running Ruff with: /home/linuxbrew/.linuxbrew/bin/ruff ['--force-exclude', '--no-cache', '--no-fix', '--quiet', '--output-format', 'json', '-', '--stdin-filename', '/home/sa/Workspace/mPLUG-Owl/test.py']
2023-11-09 13:05:31.528 [info] Using interpreter executable: /home/linuxbrew/.linuxbrew/bin/ruff
2023-11-09 13:05:31.528 [info] Found ruff 0.1.4 at /home/linuxbrew/.linuxbrew/bin/ruff
2023-11-09 13:05:31.528 [info] Running Ruff with: /home/linuxbrew/.linuxbrew/bin/ruff ['--force-exclude', '--no-cache', '--no-fix', '--quiet', '--output-format', 'json', '-', '--stdin-filename', '/home/sa/Workspace/mPLUG-Owl/test.py']
2023-11-09 13:08:58.834 [info] Using interpreter executable: /home/linuxbrew/.linuxbrew/bin/ruff
2023-11-09 13:08:58.834 [info] Found ruff 0.1.4 at /home/linuxbrew/.linuxbrew/bin/ruff
2023-11-09 13:08:58.835 [info] Running Ruff with: /home/linuxbrew/.linuxbrew/bin/ruff ['--force-exclude', '--no-cache', '--no-fix', '--quiet', '--output-format', 'json', '-', '--stdin-filename', '/home/sa/Workspace/mPLUG-Owl/test.py']
2023-11-09 13:09:01.534 [info] Using interpreter executable: /home/linuxbrew/.linuxbrew/bin/ruff
2023-11-09 13:09:01.534 [info] Found ruff 0.1.4 at /home/linuxbrew/.linuxbrew/bin/ruff
2023-11-09 13:09:01.534 [info] Running Ruff with: /home/linuxbrew/.linuxbrew/bin/ruff ['--force-exclude', '--no-cache', '--no-fix', '--quiet', '--output-format', 'json', '-', '--stdin-filename', '/home/sa/Workspace/mPLUG-Owl/test.py']
2023-11-09 13:09:01.610 [info] Using interpreter executable: /home/linuxbrew/.linuxbrew/bin/ruff
2023-11-09 13:09:01.611 [info] Found ruff 0.1.4 at /home/linuxbrew/.linuxbrew/bin/ruff
2023-11-09 13:09:01.611 [info] Running Ruff with: /home/linuxbrew/.linuxbrew/bin/ruff ['--force-exclude', '--no-cache', '--no-fix', '--quiet', '--output-format', 'json', '-', '--stdin-filename', '/home/sa/Workspace/mPLUG-Owl/test.py']
zanieb commented 1 year ago

Could you share your VS Code configuration? Do you have Ruff configured to run "onType"?

timsu92 commented 1 year ago

You need to turn it off by yourself. The configuration lint.run defaults to onType. Checkout the readme for more information

FlatMapIO commented 1 year ago

Could you share your VS Code configuration? Do you have Ruff configured to run "onType"?

{
  "workbench.editor.revealIfOpen": true,
  "workbench.startupEditor": "none",
  "security.workspace.trust.startupPrompt": "never",
  "security.workspace.trust.enabled": false,
  "editor.semanticHighlighting.enabled": true,
  "editor.bracketPairColorization.enabled": true,
  "chat.editor.fontFamily": "Monaspace Krypton Var",
  // Krypton
  "editor.fontFamily": "Monaspace Krypton Var",
  "editor.fontLigatures": true,
  "editor.formatOnPaste": false,
  "editor.formatOnType": false,
  "editor.find.cursorMoveOnType": true,
  "editor.largeFileOptimizations": true,
  "editor.quickSuggestions": {
    "other": true,
    "comments": false,
    "strings": false
  },
  // "editor.language.colorizedBracketPairs": [],
  "editor.linkedEditing": true,
  "explorer.confirmDragAndDrop": false,
  "explorer.autoReveal": false,
  "window.closeWhenEmpty": true,
  "terminal.integrated.gpuAcceleration": "auto",
  "terminal.explorerKind": "external",
  "terminal.external.osxExec": "warp.app",
  "explorer.confirmDelete": false,
  "terminal.integrated.fontFamily": "Hack Nerd Font Mono",
  "terminal.integrated.fontSize": 16,
  "terminal.integrated.defaultProfile.osx": "fish",
  "terminal.integrated.defaultProfile.linux": "fish",
  "terminal.integrated.profiles.osx": {
    "fish": {
      "path": "/opt/homebrew/bin/fish",
      "args": [
        "-l"
      ]
    }
  },
  "css.validate": true,
  "diffEditor.codeLens": true,
  "breadcrumbs.showTypeParameters": true,
  "git.autofetch": true,
  "settingsSync.ignoredSettings": [],
  "emmet.excludeLanguages": [
    "markdown",
    "typescriptreact"
  ],
  "typescript.locale": "en",
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "npm.packageManager": "pnpm",
  "js/ts.implicitProjectConfig.experimentalDecorators": true,
  "js/ts.implicitProjectConfig.checkJs": false,
  "js/ts.implicitProjectConfig.strictNullChecks": true,
  "js/ts.implicitProjectConfig.module": "ESNext",
  "js/ts.implicitProjectConfig.target": "ESNext",
  "[go]": {
    "editor.defaultFormatter": "golang.go-nightly",
    "editor.codeActionsOnSave": {
      "source.organizeImports": "explicit"
    }
  },
  "files.exclude": {
    "**/node_modules/.pnpm": true,
    "**/node_modules/**/test": true,
    "**/node_modules/**/.eslint*": true,
    "**/node_modules/**/tests": true,
    "**/node_modules/**/node_modules": true,
    "**/*.min.js": true,
    "**/*.map": true,
    ".idea": true,
    "**/.next": true
  },
  "files.trimTrailingWhitespace": true,
  "terminal.integrated.commandsToSkipShell": [
    "language-julia.interrupt"
  ],
  "files.autoSave": "onFocusChange",
  "editor.inlineSuggest.enabled": true,
  "git.confirmSync": false,
  "extensions.ignoreRecommendations": true,
  "editor.accessibilitySupport": "off",
  "terminal.integrated.env.osx": {},
  "terminal.integrated.enableMultiLinePasteWarning": false,
  "editor.stickyScroll.enabled": true,
  "diffEditor.diffAlgorithm": "advanced",
  "terminal.integrated.smoothScrolling": true,
  "editor.smoothScrolling": true,
  "vim.camelCaseMotion.enable": true,
  "vim.highlightedyank.enable": true,
  "vim.sneak": false,
  "vim.foldfix": true,
  "vim.replaceWithRegister": true,
  "vim.easymotion": true,
  "vim.easymotionMarkerForegroundColorOneChar": "white",
  "vim.easymotionMarkerForegroundColorTwoCharFirst": "white",
  "vim.easymotionKeys": "hklyuiopnmqwertzxcvbasdgjf",
  "vim.autoSwitchInputMethod.enable": true,
  // 自动切换输入法已经失效了
  // "vim.autoSwitchInputMethod.enable": true,
  // "vim.autoSwitchInputMethod.obtainIMCmd": "/opt/homebrew/bin/im-select",
  // "vim.autoSwitchInputMethod.defaultIM": "com.apple.keylayout.ABC",
  // "vim.autoSwitchInputMethod.switchIMCmd": "/opt/homebrew/bin/im-select {im}",
  "vim.normalModeKeyBindingsNonRecursive": [
    {
      "before": [
        "s"
      ],
      "after": [
        "leader",
        "leader",
        "s"
      ]
    },
    {
      "before": [
        "f"
      ],
      "after": [
        "leader",
        "leader",
        "2",
        "s"
      ]
    }
  ],
  "typescript.updateImportsOnFileMove.enabled": "always",
  "javascript.updateImportsOnFileMove.enabled": "always",
  "editor.tabSize": 2,
  "workbench.editor.closeOnFileDelete": true,
  "search.exclude": {
    "**/node_modules": true,
    "**/bower_components": true,
    "**/*.code-search": true,
    "**/pnpm-lock.yaml": true,
    "**/package-lock.json": true,
    "**/go.sum": true
  },
  "[typescript]": {
    "editor.codeActionsOnSave": {
      "source.organizeImports": "explicit"
    },
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[typescriptreact]": {
    "editor.codeActionsOnSave": {
      "source.organizeImports": "never"
    },
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[json]": {
    "editor.defaultFormatter": "vscode.json-language-features"
  },
  "typescript.autoClosingTags": true,
  "html.autoClosingTags": true,
  "[jsonc]": {
    "editor.defaultFormatter": "vscode.json-language-features"
  },
  "typescript.implementationsCodeLens.enabled": true,
  "typescript.referencesCodeLens.showOnAllFunctions": true,
  "typescript.preferences.quoteStyle": "single",
  "typescript.preferences.importModuleSpecifier": "shortest",
  "typescript.suggest.completeFunctionCalls": false,
  "typescript.suggest.jsdoc.generateReturns": false,
  "typescript.suggest.completeJSDocs": false,
  "typescript.preferences.useAliasesForRenames": false,
  "editor.wordBasedSuggestions": true,
  // vscode-postfix-ts depende this
  // "editor.snippetSuggestions": "none",
  "editor.acceptSuggestionOnCommitCharacter": false,
  "editor.defaultColorDecorators": true,
  "[python]": {
    "editor.defaultFormatter": "charliermarsh.ruff"
  },
  "markdown.preview.typographer": true,
  "scm.defaultViewMode": "tree",
  "markdown.updateLinksOnFileMove.enabled": "always",
  "workbench.colorTheme": "Sublime Material Theme - Dark",
  "codeium.enableSearch": true,
  "codeium.enableConfig": {
    "*": true,
    "dockercompose": true,
    "properties": true,
    "prisma": true,
    "markdown": true,
    "fish": true,
    "plaintext": true,
    "mojo": true
  },
  "inlineChat.mode": "livePreview",
  "[svg]": {
    "editor.defaultFormatter": "jock.svg"
  },
  "editor.tokenColorCustomizations": {
    "textMateRules": [
      {
        "scope": "keyword.other.dotenv",
        "settings": {
          "foreground": "#FF000000"
        }
      }
    ]
  },
  "zig.zls.path": "/opt/local/bin/zls",
  "zig.zls.zigLibPath": "/opt/local/lib/zig",
  "zig.zigPath": "/opt/local/bin/zig",
  "zig.zls.includeAtInBuiltins": true,
  "zig.astCheckProvider": "zls",
  "zig.formattingProvider": "zls",
  "zig.zls.checkForUpdate": false,
  "panda.color-hints.color-preview.enabled": true,
  "panda.hovers.semantic-colors.enabled": true,
  "panda.hovers.tokens.css-preview.enabled": true,
  "panda.hovers.instances.enabled": true,
  "panda.hovers.tokens.conditions.enabled": true,
  "panda.rem-to-px.enabled": true,
  "remote.SSH.remotePlatform": {
    "sandbox.p6vxp5.csb": "linux"
  },
  "editor.fontSize": 16,
  "go.toolsManagement.autoUpdate": true,
  "window.commandCenter": false,
  "window.zoomLevel": -1,
  "files.associations": {
    "*.excalidraw": "json",
    "*.excalidrawlib": "json",
    ".env*": "dotenv"
  },
  "python.languageServer": "Pylance",
  "python.analysis.autoFormatStrings": true,
  "mojo.modularHomePath": "${userHome}/.modular",
  "workbench.iconTheme": "material-icon-theme",
  "[fish]": {
    "editor.defaultFormatter": "bmalehorn.vscode-fish"
  },
}
charliermarsh commented 1 year ago

You can add "ruff.lint.run": "onSave" to your configuration to avoid running Ruff on every change. Let me know if you run into any issues!