Skip to content

Instantly share code, notes, and snippets.

@watermouth
Last active June 17, 2019 12:33
Show Gist options
  • Select an option

  • Save watermouth/3fa63a3e52bd133cb9bd9a0c190bff42 to your computer and use it in GitHub Desktop.

Select an option

Save watermouth/3fa63a3e52bd133cb9bd9a0c190bff42 to your computer and use it in GitHub Desktop.

Visual Studio Code (VS Code) の各種設定・使用法

  • OS: Windows 10

使用方法

基本コマンド

  • Ctrl + shift + p: vs code 上のコマンドプロンプトを開ける.
  • Ctrl + p: エディタ上での操作コマンドプロンプトを選択できる. ファイルを開くこともできる.

設定ファイル

Ctrl + p で 表示される settings.json が設定ファイルである。 .vscode フォルダ中のファイルと, ユーザ固有フォルダ中のファイルの2つある。 .vscodeフォルダは、該当ワークスペースに対するフォルダである。

CTags

経緯

Ctrl + t を押すと何やらエラーが出る。ポイントしている部分の定義参照機能らしい。 右下に出てくるメッセージに従い、何やらインストールを実行すると、ターミナルにメッセージが出てくる。 そのメッセージに従って対応する。

行動

http://ctags.sourceforge.net/ からバイナリファイル http://prdownloads.sourceforge.net/ctags/ctags58.zip をダウンロードして展開してできるフォルダのパスを、vs code のsettings.jsonの python.workspaceSymbols.ctagsPath 設定する。

参考サイト: https://donjayamanne.github.io/pythonVSCodeDocs/docs/workspaceSymbols/

Python Interactive window

hoge.py ファイルを編集中、shift + enter で指定した行をPython Interactive Windowにて実行できる. Python Interactive Window は Jupyter notebookを実行している。 これの実行時に、何やらエラーが出た。 指定したPython environmentのJupyterが使われず、別のものが使われる、というようなもの。

https://github.com/Microsoft/vscode-python/issues/5197

ここに書かれている通り、tornadoの古いバージョンをインストールすればエラーが消えた。

pylintの不適切な赤線エラー?

参考: https://ruddra.com/posts/vs-code-for-python-development/

色々他にも参考にしたが、 settings.jsonに以下を追加すると消せた。
pylingArgs がポイントだと思うが...設定の意味からしておかしいようだ...

    "python.linting.pylintEnabled": true,
    "python.linting.pylintArgs": ["--load-plugins"],
    "python.linting.enabled": true

他に見て試したもの...

見たほうが良さそうなもの

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment