diff --git a/.clangd b/.clangd new file mode 100644 index 000000000..7cfd47b0e --- /dev/null +++ b/.clangd @@ -0,0 +1,2 @@ +CompileFlags: + CompilationDatabase: ext/rbs_extension diff --git a/.gitignore b/.gitignore index c6b874df3..23c663ad8 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,7 @@ lib/**/*.dll doc/ **/*.gem + +# For clangd's editor integration +ext/rbs_extension/compile_commands.json +ext/rbs_extension/.cache diff --git a/Gemfile b/Gemfile index 095664ffa..9cef14ea8 100644 --- a/Gemfile +++ b/Gemfile @@ -20,6 +20,7 @@ gem "rdoc" gem "fileutils" gem "raap" gem "activesupport", "~> 7.0" +gem "extconf_compile_commands_json" group :libs do # Libraries required for stdlib test diff --git a/Gemfile.lock b/Gemfile.lock index 77d807549..2442584ec 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -40,6 +40,7 @@ GEM diff-lcs (1.6.2) digest (3.2.0) drb (2.2.1) + extconf_compile_commands_json (0.0.7) ffi (1.17.2) fileutils (1.7.3) goodcheck (3.1.0) @@ -184,6 +185,7 @@ DEPENDENCIES csv dbm digest + extconf_compile_commands_json fileutils goodcheck json diff --git a/ext/rbs_extension/extconf.rb b/ext/rbs_extension/extconf.rb index e6376f483..ba42c3c6e 100644 --- a/ext/rbs_extension/extconf.rb +++ b/ext/rbs_extension/extconf.rb @@ -25,3 +25,7 @@ end create_makefile 'rbs_extension' + +require 'extconf_compile_commands_json' +ExtconfCompileCommandsJson.generate! +ExtconfCompileCommandsJson.symlink!