Skip to content

Commit 242422f

Browse files
st0012amomchilov
andcommitted
Add clangd integration for improved C extension development
- Added extconf_compile_commands_json for generating and symlinking compile_commands.json - Added .clangd config to point to compilation database Co-authored-by: Alexander Momchilov <[email protected]>
1 parent 66c2c91 commit 242422f

File tree

5 files changed

+13
-0
lines changed

5 files changed

+13
-0
lines changed

.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"
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
@@ -40,6 +40,7 @@ GEM
4040
diff-lcs (1.6.2)
4141
digest (3.2.0)
4242
drb (2.2.1)
43+
extconf_compile_commands_json (0.0.7)
4344
ffi (1.17.2)
4445
fileutils (1.7.3)
4546
goodcheck (3.1.0)
@@ -184,6 +185,7 @@ DEPENDENCIES
184185
csv
185186
dbm
186187
digest
188+
extconf_compile_commands_json
187189
fileutils
188190
goodcheck
189191
json

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)