0
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

vscodeにGNU global

Posted at

はじめに

vscode使うはいいが、これコード参照大丈夫?
ソースコードの静的解析、定義先・参照先ジャンプといえばGNU global。

env

$ uname -r
4.19.104-microsoft-standard
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04 LTS"

global導入

$ sudo apt install global

vscode plugin

settings.json
{
  "gnuGlobal.autoUpdate": "Enabled",
  "gnuGlobal.encoding": "utf8",
  "gnuGlobal.globalExecutable": "/usr/bin/global",
  "gnuGlobal.gtagsExecutable": "/usr/bin/gtags",
  "gnuGlobal.gtagsForceCpp": "Enabled",
}

使い方

更新はコマンドパレットshift + ctrl + PからGlobal: Rebuild Gtags Databaseを選択・実行する

ソースファイルやヘッダフィルの中で、

  • F12で定義に飛ぶ
  • shift + F12で定義や宣言、呼び出しの一覧
  • shift + alt + F12で全体からの一覧
    • サイドバーに出るので使うとしたら大規模なコードを追うときかな

どうなった?

これで読むほうは楽になったかな。
書く時の支援はVisual Studio IntelliCode pluginを導入しておけばよかろう。
(IntelliCodeに不満がないわけではないが)

0
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?