Skip to content

Commit 05c5610

Browse files
committed
Merge pull request #2481 from Shopify/setup-clangd
Add clangd integration for improved C extension development
1 parent d508222 commit 05c5610

5 files changed

Lines changed: 13 additions & 0 deletions

File tree

.clangd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CompileFlags:
2+
CompilationDatabase: ext/rbs_extension

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ lib/**/*.dll
2121
doc/
2222

2323
**/*.gem
24+
25+
# For clangd's editor integration
26+
ext/rbs_extension/compile_commands.json
27+
ext/rbs_extension/.cache

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ gem "rdoc", "~> 6.11.0"
2020
gem "fileutils"
2121
gem "raap"
2222
gem "activesupport", "~> 7.0"
23+
gem "extconf_compile_commands_json"
2324

2425
group :libs do
2526
# Libraries required for stdlib test

Gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ GEM
3939
diff-lcs (1.6.1)
4040
digest (3.2.0)
4141
drb (2.2.1)
42+
extconf_compile_commands_json (0.0.7)
4243
ffi (1.17.2)
4344
fileutils (1.7.3)
4445
goodcheck (3.1.0)
@@ -183,6 +184,7 @@ DEPENDENCIES
183184
csv
184185
dbm
185186
digest
187+
extconf_compile_commands_json
186188
fileutils
187189
goodcheck
188190
json (~> 2.10.2)

ext/rbs_extension/extconf.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@
2525
end
2626

2727
create_makefile 'rbs_extension'
28+
29+
require 'extconf_compile_commands_json'
30+
ExtconfCompileCommandsJson.generate!
31+
ExtconfCompileCommandsJson.symlink!

0 commit comments

Comments
 (0)