VSCode #
安装 #
brew cask install visual-studio-code
配置 #
settings.json
{
"gitlens.advanced.messages": {
"suppressShowKeyBindingsNotice": true
},
"gitlens.historyExplorer.enabled": true,
"java.errors.incompleteClasspath.severity": "ignore",
"materialTheme.autoApplyIcons": true,
"workbench.colorCustomizations": {},
"materialTheme.accentPrevious": "Breaking Bad",
"materialTheme.fixIconsRunning": false,
// Controls the font family.
"editor.fontFamily": "Consolas, '微软雅黑', Dengxian, Menlo, Monaco, 'Courier New', monospace",
// "editor.fontFamily": "Inconsolata, Consolas, '微软雅黑', Dengxian, Menlo, Monaco, 'Courier New', monospace",
"editor.lineHeight": 22,
"editor.fontSize": 14,
"workbench.startupEditor": "newUntitledFile",
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"python.jediEnabled": false,
"leetcode.endpoint": "leetcode-cn",
"python.linting.pylintEnabled": true,
"leetcode.defaultLanguage": "golang",
"leetcode.hint.configWebviewMarkdown": false,
"leetcode.hint.commentDescription": false,
"[go]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
},
// Optional: Disable snippets, as they conflict with completion ranking.
"editor.snippetSuggestions": "none",
},
"[go.mod]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
},
},
"gopls": {
// Add parameter placeholders when completing a function.
"usePlaceholders": true,
// If true, enable additional analyses with staticcheck.
// Warning: This will significantly increase memory usage.
"staticcheck": false,
},
"leetcode.workspaceFolder": "/Users/yewang/.leetcode",
"leetcode.hint.commandShortcut": false,
// Configure glob patterns for excluding files and folders.
// For example, the files explorer decides which files and folders to show or hide based on this setting.
// Read more about glob patterns [here](https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options).
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},
// "http.proxy": "http://127.0.0.1:5081",
"terminal.integrated.inheritEnv": true,
"terminal.integrated.shell.osx": "/bin/zsh",
// 为了使用 agnoster zsh 主题
"terminal.integrated.fontFamily": "Meslo LG M DZ for Powerline",
// "terminal.integrated.fontFamily": "Meslo LG M for Powerline",
"terminal.integrated.rendererType": "dom",
"terminal.integrated.copyOnSelection": true,
"sourcetrail.startServerAtStartup": true,
// vim
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": [
":"
],
"commands": [
"workbench.action.showCommands",
]
},
{
"before": [
"<leader>",
"m"
],
"commands": [
"bookmarks.toggle"
]
},
{
"before": [
"<leader>",
"b"
],
"commands": [
"bookmarks.list"
]
},
{
"before": [
"Z",
"Z"
],
"commands": [
":wq"
]
},
{
"before": [
"<C-n>"
],
"commands": [
":nohl",
]
},
{
"before": [
"leader",
"w"
],
"commands": [
"workbench.action.files.save",
]
},
],
// 无法兼容 R 插入模式
// "vim.insertModeKeyBindings": [
// {
// "before": ["j", "j"],
// "after": ["<Esc>"]
// }
// ],
"vim.visualModeKeyBindingsNonRecursive": [
{
"before": [
"p",
],
"after": [
"p",
"g",
"v",
"y"
]
},
{
"before": [
">"
],
"commands": [
"editor.action.indentLines"
]
},
{
"before": [
"<"
],
"commands": [
"editor.action.outdentLines"
]
},
],
"explorer.confirmDragAndDrop": false,
"explorer.confirmDelete": false,
"markdown-preview-enhanced.automaticallyShowPreviewOfMarkdownBeingEdited": false,
"markdown.extension.preview.autoShowPreviewToSide": false,
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
// Activate Python Environment in Terminal created using the Extension.
"python.terminal.activateEnvironment": false,
// Path to folder with a list of Virtual Environments (e.g. ~/.pyenv, ~/Envs, ~/.virtualenvs).
"python.venvPath": "~/.local/share/virtualenvs",
"editor.largeFileOptimizations": false,
"C_Cpp.updateChannel": "Insiders",
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
// Format a file on save. A formatter must be available, the file must not be saved after delay, and the editor must not be shutting down.
"editor.formatOnSave": false,
"[cpp]": {
"editor.defaultFormatter": "ms-vscode.cpptools"
},
"clang-format.executable": "/Users/yewang/.vscode/extensions/ms-vscode.cpptools-0.27.0-insiders3/LLVM/bin/clang-format.darwin",
"[json]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
// markdownlint config object
"markdownlint.config": {
"MD004": false,
"MD013": false,
"MD024": false,
"MD025": false,
"MD026": false,
"MD040": false,
"MD045": false,
},
"markdownlint.run": "onSave",
"window.title": "${dirty} ${activeEditorMedium}${separator}${rootName}",
// 右侧概览 用色块代替缩小的字符; 设置水平最大列数; 始终显示滑块
"editor.minimap.renderCharacters": false,
"editor.minimap.maxColumn": 200,
"editor.minimap.showSlider": "always",
// 标签
"editor.smoothScrolling": true,
"editor.cursorBlinking": "phase",
// "editor.cursorSmoothCaretAnimation": true,
// 最后一行
"files.insertFinalNewline": true,
// 取消最后空格
"files.trimTrailingWhitespace": true,
// 取消发送给 ms
"telemetry.enableCrashReporter": false,
"telemetry.enableTelemetry": false,
"workbench.settings.enableNaturalLanguageSearch": false,
// "editor.renderWhitespace": "all",
"editor.wordWrap": "on",
// Fit code within this line limit
// "prettier.printWidth": 80,
// Controls the wrapping column of the editor when `editor.wordWrap` is `wordWrapColumn` or `bounded`.
// "editor.wordWrapColumn": 80,
"python.formatting.autopep8Args": [
"--max-line-length=100"
],
"javascript.updateImportsOnFileMove.enabled": "always",
"[javascript]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"[java]": {
"editor.defaultFormatter": "redhat.java"
},
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"java.semanticHighlighting.enabled": true,
"extensions.ignoreRecommendations": true,
"java.project.importOnFirstTimeStartup": "automatic",
"picgo.picBed.current": "github",
"picgo.picBed.github.repo": "ikingye/imagehost",
"picgo.picBed.github.token": "",
"picgo.picBed.github.branch": "master",
"picgo.picBed.github.customUrl": "https://cdn.jsdelivr.net/gh/ikingye/imagehost",
"picgo.picBed.github.path": "picgo/",
"picgo.customOutputFormat": "![](${url})",
"sonarlint.rules": {
"Web:LinkToImageCheck": {
"level": "off"
}
},
"python.showStartPage": false,
"hediet.vscode-drawio.codeLinkActivated": true,
// "hediet.vscode-drawio.theme": "dark"
// set light theme
"hediet.vscode-drawio.theme": "atlas",
// "hediet.vscode-drawio.theme": "Kennedy",
// Configure which editor to use for specific file types.
"workbench.editorAssociations": {
"*.png": "hediet.vscode-drawio",
"*.svg": "hediet.vscode-drawio-text",
"*.drawio": "hediet.vscode-drawio-text",
"*.ipynb": "jupyter-notebook"
},
"[dockerfile]": {
"editor.defaultFormatter": "ms-azuretools.vscode-docker"
},
"jupyter.sendSelectionToInteractiveWindow": true,
"pasteImage.defaultName": "YMMDDHHmmss",
"pasteImage.path": "${projectRoot}/private/static/image/2021",
"jupyter.alwaysTrustNotebooks": true,
"tabnine.experimentalAutoImports": true,
"[php]": {
"editor.defaultFormatter": "bmewburn.vscode-intelephense-client"
},
"todo-tree.tree.showScanModeButton": true,
"todo-tree.regex.regex": "(//|#|<!--|;|/\\*|^|^\\s*(-|\\d+.))\\s*($TAGS)",
"todo-tree.general.tags": [
"BUG",
"HACK",
"FIXME",
"TODO",
"XXX",
"[ ]",
"[x]"
],
"todo-tree.highlights.customHighlight": {
"[ ]": {
"background": "#ff000080"
},
"[x]": {
"background": "#00ff0080"
},
"TODO": {
"icon": "check",
"type": "line"
},
"FIXME": {
"foreground": "black",
"iconColour": "yellow",
"gutterIcon": true
}
},
"go.toolsManagement.autoUpdate": true,
"go.toolsEnvVars": {
"GOPROXY": "https://goproxy.cn,direct",
},
"editor.codeActionsOnSave": null,
"editor.accessibilitySupport": "off",
"security.workspace.trust.startupPrompt": "never",
"security.workspace.trust.enabled": false,
"redhat.telemetry.enabled": true,
"files.associations": {
"*.md": "markdown"
},
"notebook.cellToolbarLocation": {
"default": "right",
"jupyter-notebook": "left"
},
"workbench.editor.untitled.hint": "hidden",
"workbench.colorTheme": "Material Theme",
"cSpell.enableFiletypes": [
"!less"
],
"bracketPairColorizer.depreciation-notice": false,
}
参考:
插件 #
插件列表 #
code --list-extensions
code --list-extensions --show-versions
List your installed VS Code extensions in a Markdown file
参考:
推荐插件 #
插件 | 类型 | 推荐 | 备注 |
---|---|---|---|
ESLint | 格式化 - JavaScript | ★★★★ | |
TabNine | 代码补全 | ★★★★ |
ESLint #
TabNine #
Tabnine works with all major programming languages including JavaScript, Python, TypeScript, PHP, C/C++, HTML/CSS, Go, Java, Ruby, C#, Rust, SQL, Bash, Kotlin, Julia, Lua, OCaml, Perl, Haskell, and React.
参考:
PicGo/vs-picgo #
https://github.com/PicGo/vs-picgo
format #
autopep8 #
设置每行最大长度
"python.formatting.autopep8Args": [
"--max-line-length=200"
]
Draw.io
#
This unofficial extension integrates Draw.io
(also known as diagrams.net
) into VS Code.
设置背景色
For set light theme, add in your settings.json next:
"hediet.vscode-drawio.theme": "atlas"
// or if you'd like white menu on the top, not blue, use "Kennedy" theme
"hediet.vscode-drawio.theme": "Kennedy"
// or if you mostly view, not edit, use "minimal" theme
"hediet.vscode-drawio.theme": "min"
Dark:
"hediet.vscode-drawio.theme": "dark"
参考:
Paste Image #
mushanshitiancai/vscode-paste-image
paste image from clipboard to markdown/asciidoc directly!
快捷键 #
Debug #
参考:
常见问题 #
Could not create temporary directory: Permission denied #
sudo chown -R $USER ~/Library/Caches/*
叶王 © 2013-2024 版权所有。如果本文档对你有所帮助,可以请作者喝饮料。