Reputation: 115
I'm working on a C project that, for some odd reason has many header files that are named with an extension of .inc
instead of .h
.
So, for example instead of calling a file header1.h
it will be called header1.inc
. Other than that the .inc files are C header files in every way.
For some reason, it seems like these files are properly indexed or parsed by clangd. So, for example when I try to go-to definition of something in a .inc file it doesn't work, even if the definition is done right above the line.
Looks to me like clangd just ignores these .inc
files. Is there any way to make clangd treat .inc
files as .h
files?
Some verbose logs of opening a .inc file:
V[20:48:44.722] <<< {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"c","text":"\n\n#include \"main/infra/arithmetic_api.h\"\n#include \"main/infra/asserts/assert_api.h\"\n#include <stddef.h>\n\ntypedef struct _IOVec_Stream_V {\n const struct iovec *iovec;\n uint32_t count;\n\n IOVec_StreamCursor_T cursor;\n uint64_t bytes_left;\n} IOVec_Stream_V;\n\n#define PRIVATE_IOVEC__STREAM_INIT(_iovec, _count) PRIVATE_IOVEC__STREAM_INIT_TRUNCATED(_iovec, _count, UINT32_MAX)\n\n#define PRIVATE_IOVEC__STREAM_INIT_TRUNCATED(_iovec, _count, _truncate_at_byte_count) \\\n { \\\n .iovec = _iovec, .count = _count, .cursor = { 0, 0 }, .bytes_left = _truncate_at_byte_count, \\\n }\n\n#define PRIVATE_IOVEC__STREAM_TRUNCATED_COPY(_stream, _truncate_at_byte_count) \\\n { \\\n .iovec = (_stream).iovec, .count = (_stream).count, .cursor = (_stream).cursor, \\\n .bytes_left = MIN(_truncate_at_byte_count, (_stream).bytes_left), \\\n }\n\nstatic inline IOVec_StreamCursor_T iovec__stream_get_cursor(const IOVec_Stream_V *stream)\n{\n return stream->cursor;\n}\n\nstatic inline IOVec_Interval iovec__stream_cur_interval(const IOVec_Stream_V *stream)\n{\n const uint32_t current_index = stream->cursor.index;\n\n // Nothing more to stream from this buffer?\n if (!iovec__stream_has_more(stream)) {\n return (IOVec_Interval){ .base = NULL, .length_bytes = 0 };\n }\n\n const struct iovec *const current_iovec = &stream->iovec[current_index];\n ASSERT_NOT_NULL(current_iovec->iov_base, \"An IOVec NULL entry encountered. index=%s, length=%s\", current_index,\n current_iovec->iov_len);\n ASSERT_CMP(current_iovec->iov_len, >, 0U, \"iov_len of zero is currently unsupported\");\n\n const uint64_t bytes_left_in_cur_iovec = current_iovec->iov_len - stream->cursor.offset_bytes;\n return (IOVec_Interval){\n .base = (UByte *)current_iovec->iov_base + stream->cursor.offset_bytes,\n .length_bytes = min(stream->bytes_left, bytes_left_in_cur_iovec),\n };\n}\n\nstatic inline void iovec__stream_skip_bytes(IOVec_Stream_V *s, uint64_t skip_bytes)\n{\n const bool res = iovec__stream_try_skip_bytes(s, skip_bytes);\n ASSERT(res, \"iovec__stream_try_skip_bytes: Failed\");\n}\n\nstatic inline IOVec_Interval iovec__stream_advance(IOVec_Stream_V *stream)\n{\n IOVec_Interval interval = iovec__stream_cur_interval(stream);\n iovec__stream_skip_bytes(stream, interval.length_bytes);\n\n return interval;\n}\n\nstatic inline IOVec_Interval iovec__stream_advance_limit(IOVec_Stream_V *stream, uint64_t max_bytes_to_read)\n{\n IOVec_Interval interval = iovec__stream_cur_interval(stream);\n interval.length_bytes = min(interval.length_bytes, max_bytes_to_read);\n iovec__stream_skip_bytes(stream, interval.length_bytes);\n\n return interval;\n}\n\nstatic inline bool iovec__stream_has_more(const IOVec_Stream_V *stream)\n{\n return (stream->cursor.index < stream->count) && stream->bytes_left > 0;\n}\n\nstatic inline uint64_t iovec__stream_bytes_left(const IOVec_Stream_V *stream)\n{\n return stream->bytes_left;\n}\n\nstatic inline bool iovec__stream_try_data_copy_to_buf(UByte dest_buf[/*length_bytes*/], IOVec_Stream_V *src_stream,\n uint64_t length_bytes)\n{\n struct iovec dest_iovecs[] = { { dest_buf, length_bytes } };\n IOVec_Stream_V dest_stream = IOVEC__STREAM_INIT(dest_iovecs, ARRAY_LEN(dest_iovecs));\n return (IOVEC__STREAM_COPY_SUCCESS == iovec__stream_try_data_copy(&dest_stream, src_stream, length_bytes));\n}\n\nstatic inline bool iovec__stream_try_data_copy_from_buf(IOVec_Stream_V *dest_stream,\n const UByte src_buf[/*length_bytes*/], uint64_t length_bytes)\n{\n struct iovec src_iovecs[] = { { (UByte *)src_buf, length_bytes } };\n IOVec_Stream_V src_stream = IOVEC__STREAM_INIT(src_iovecs, ARRAY_LEN(src_iovecs));\n return (IOVEC__STREAM_COPY_SUCCESS == iovec__stream_try_data_copy(dest_stream, &src_stream, length_bytes));\n}\n\nstatic inline void iovec__stream_data_copy_to_buf(UByte dest_buf[/*length_bytes*/], IOVec_Stream_V *src_stream,\n uint64_t length_bytes)\n{\n ASSERT(iovec__stream_try_data_copy_to_buf(dest_buf, src_stream, length_bytes), \"%s, length: %s\", *src_stream,\n length_bytes);\n}\n\nstatic inline void iovec__stream_data_copy_from_buf(IOVec_Stream_V *dest_stream,\n const UByte src_buf[/*length_bytes*/], uint64_t length_bytes)\n{\n ASSERT(iovec__stream_try_data_copy_from_buf(dest_stream, src_buf, length_bytes), \"%s, length: %s\", *dest_stream,\n length_bytes);\n}\n\nstatic inline void iovec__stream_data_copy(IOVec_Stream_V *dst_stream, IOVec_Stream_V *src_stream,\n uint64_t length_bytes)\n{\n const enum IOVec__StreamCopyResult res = iovec__stream_try_data_copy(dst_stream, src_stream, length_bytes);\n const enum IOVec__StreamCopyResult expected = IOVEC__STREAM_COPY_SUCCESS;\n ASSERT_EQUALS(res, expected);\n}\n\nstatic inline void iovec__stream_memset(IOVec_Stream_V *dst_stream, UByte val, uint64_t length_bytes)\n{\n const bool success = iovec__stream_try_memset(dst_stream, val, length_bytes);\n ASSERT(success, \"memset hit end of buffer\");\n}\n\n#define _IOVEC__STREAM_DATA_COPY_TO_TYPE(stream, var) \\\n iovec__stream_data_copy_to_buf((UByte *)&var, stream, sizeof(var))\n","uri":"file:///usr/home/work/project/main/infra/iovec/stream_private.inc","version":1}}}
I[20:48:44.722] <-- textDocument/didOpen
V[20:48:44.722] <<< {"id":54,"jsonrpc":"2.0","method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///usr/home/work/project/main/infra/iovec/stream_private.inc"}}}
I[20:48:44.722] <-- textDocument/documentSymbol(54)
V[20:48:44.722] <<< {"id":55,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///usr/home/work/project/main/infra/iovec/stream_private.inc"}}}
I[20:48:44.722] <-- textDocument/semanticTokens/full(55)
V[20:48:44.722] <<< {"id":56,"jsonrpc":"2.0","method":"textDocument/documentLink","params":{"textDocument":{"uri":"file:///usr/home/work/project/main/infra/iovec/stream_private.inc"}}}
I[20:48:44.722] <-- textDocument/documentLink(56)
I[20:48:44.722] ASTWorker building file /usr/home/work/project/main/infra/iovec/stream_private.inc version 1 with command
[/usr/home/work/project/main]
/usr/home/.vscode-server/data/User/globalStorage/llvm-vs-code-extensions.vscode-clangd/install/18.1.3/clangd_18.1.3/bin/clang-tool -std=gnu11 -DGLINUX -D_GNU_SOURCE -DCOMPILE_UNIT=__BASE_FILE__ -I.. -I../bazel-bin -Wconversion -Wall -Wextra -Winit-self -Wswitch-enum -Wendif-labels -Wconversion -Wmissing-prototypes -Wunused_result -Wno-cast-align -Wwrite-strings -Wfloat-equal -Wunreachable-code -Wvla -Wno-shadow -Wno-address-of-packed-member -resource-dir=/usr/home/.vscode-server/data/User/globalStorage/llvm-vs-code-extensions.vscode-clangd/install/18.1.3/clangd_18.1.3/lib/clang/18 -- /usr/home/work/project/main/infra/iovec/stream_private.inc
V[20:48:44.723] Ignored diagnostic. /usr/home/work/project/main/infra/iovec/stream_private.inc: 'linker' input unused
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Xclang -no-round-trip-args'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-D GLINUX'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-D _GNU_SOURCE'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-D COMPILE_UNIT=__BASE_FILE__'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-I ..'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-I ../bazel-bin'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wconversion'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wall'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wextra'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Winit-self'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wswitch-enum'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wendif-labels'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wconversion'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wmissing-prototypes'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wunused_result'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wno-cast-align'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wwrite-strings'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wfloat-equal'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wunreachable-code'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wvla'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wno-shadow'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wno-address-of-packed-member'
E[20:48:44.723] Could not build CompilerInvocation for file /usr/home/work/project/main/infra/iovec/stream_private.inc
I[20:48:44.723] --> textDocument/publishDiagnostics
V[20:48:44.723] >>> {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"code":"fe_expected_compiler_job","message":"Unable to handle compilation, expected exactly one compiler job in ''","range":{"end":{"character":0,"line":0},"start":{"character":0,"line":0}},"relatedInformation":[],"severity":1,"source":"clang"}],"uri":"file:///usr/home/work/project/main/infra/iovec/stream_private.inc","version":1}}
V[20:48:44.723] Ignored diagnostic. /usr/home/work/project/main/infra/iovec/stream_private.inc: 'linker' input unused
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Xclang -no-round-trip-args'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-D GLINUX'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-D _GNU_SOURCE'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-D COMPILE_UNIT=__BASE_FILE__'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-I ..'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-I ../bazel-bin'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wconversion'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wall'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wextra'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Winit-self'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wswitch-enum'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wendif-labels'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wconversion'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wmissing-prototypes'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wunused_result'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wno-cast-align'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wwrite-strings'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wfloat-equal'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wunreachable-code'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wvla'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wno-shadow'
V[20:48:44.723] Ignored diagnostic. argument unused during compilation: '-Wno-address-of-packed-member'
V[20:48:44.723] ASTWorker rebuilding evicted AST to run DocumentSymbols: /usr/home/work/project/main/infra/iovec/stream_private.inc version 1
I[20:48:44.723] --> reply:textDocument/documentSymbol(54) 1 ms, error: invalid AST
V[20:48:44.723] >>> {"error":{"code":-32001,"message":"invalid AST"},"id":54,"jsonrpc":"2.0"}
I[20:48:44.723] --> reply:textDocument/semanticTokens/full(55) 1 ms, error: invalid AST
V[20:48:44.723] >>> {"error":{"code":-32001,"message":"invalid AST"},"id":55,"jsonrpc":"2.0"}
I[20:48:44.723] --> reply:textDocument/documentLink(56) 1 ms, error: invalid AST
V[20:48:44.723] >>> {"error":{"code":-32001,"message":"invalid AST"},"id":56,"jsonrpc":"2.0"}
I[20:48:44.723] --> textDocument/clangd.fileStatus
V[20:48:44.723] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///usr/home/work/project/main/infra/iovec/stream_private.inc"}}
[Error - 8:48:44 PM] Request textDocument/documentSymbol failed.
[object Object]
[Error - 8:48:44 PM] Request textDocument/semanticTokens/full failed.
[object Object]
[Error - 8:48:44 PM] Request textDocument/documentLink failed.
[object Object]
V[20:48:44.980] <<< {"id":57,"jsonrpc":"2.0","method":"textDocument/foldingRange","params":{"textDocument":{"uri":"file:///usr/home/work/project/main/infra/iovec/stream_private.inc"}}}
I[20:48:44.980] <-- textDocument/foldingRange(57)
V[20:48:44.980] <<< {"id":58,"jsonrpc":"2.0","method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///usr/home/work/project/main/infra/iovec/stream_private.inc"}}}
I[20:48:44.980] <-- textDocument/documentSymbol(58)
I[20:48:44.980] --> reply:textDocument/documentSymbol(58) 0 ms, error: invalid AST
V[20:48:44.980] >>> {"error":{"code":-32001,"message":"invalid AST"},"id":58,"jsonrpc":"2.0"}
[Error - 8:48:44 PM] Request textDocument/documentSymbol failed.
[object Object]
I[20:48:44.980] --> textDocument/clangd.fileStatus
V[20:48:44.980] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///usr/home/work/project/main/infra/iovec/stream_private.inc"}}
I[20:48:44.980] --> reply:textDocument/foldingRange(57) 0 ms
V[20:48:44.980] >>> {"id":57,"jsonrpc":"2.0","result":[{"endLine":11,"kind":"region","startCharacter":32,"startLine":6},{"endLine":29,"kind":"region","startCharacter":1,"startLine":28},{"endLine":50,"kind":"region","startCharacter":1,"startLine":33},{"endCharacter":4,"endLine":38,"kind":"region","startCharacter":42,"startLine":37},{"endCharacter":4,"endLine":49,"kind":"region","startCharacter":28,"startLine":47},{"endLine":56,"kind":"region","startCharacter":1,"startLine":54},{"endLine":64,"kind":"region","startCharacter":1,"startLine":60},{"endLine":73,"kind":"region","startCharacter":1,"startLine":68},{"endLine":78,"kind":"region","startCharacter":1,"startLine":77},{"endLine":83,"kind":"region","startCharacter":1,"startLine":82},{"endLine":91,"kind":"region","startCharacter":1,"startLine":88},{"endLine":99,"kind":"region","startCharacter":1,"startLine":96},{"endLine":106,"kind":"region","startCharacter":1,"startLine":104},{"endLine":113,"kind":"region","startCharacter":1,"startLine":111},{"endLine":121,"kind":"region","startCharacter":1,"startLine":118},{"endLine":127,"kind":"region","startCharacter":1,"startLine":125}]}
V[20:48:45.170] <<< {"id":59,"jsonrpc":"2.0","method":"textDocument/foldingRange","params":{"textDocument":{"uri":"file:///usr/home/work/project/main/infra/iovec/stream_private.inc"}}}
I[20:48:45.170] <-- textDocument/foldingRange(59)
I[20:48:45.171] --> reply:textDocument/foldingRange(59) 0 ms
V[20:48:45.171] >>> {"id":59,"jsonrpc":"2.0","result":[{"endLine":11,"kind":"region","startCharacter":32,"startLine":6},{"endLine":29,"kind":"region","startCharacter":1,"startLine":28},{"endLine":50,"kind":"region","startCharacter":1,"startLine":33},{"endCharacter":4,"endLine":38,"kind":"region","startCharacter":42,"startLine":37},{"endCharacter":4,"endLine":49,"kind":"region","startCharacter":28,"startLine":47},{"endLine":56,"kind":"region","startCharacter":1,"startLine":54},{"endLine":64,"kind":"region","startCharacter":1,"startLine":60},{"endLine":73,"kind":"region","startCharacter":1,"startLine":68},{"endLine":78,"kind":"region","startCharacter":1,"startLine":77},{"endLine":83,"kind":"region","startCharacter":1,"startLine":82},{"endLine":91,"kind":"region","startCharacter":1,"startLine":88},{"endLine":99,"kind":"region","startCharacter":1,"startLine":96},{"endLine":106,"kind":"region","startCharacter":1,"startLine":104},{"endLine":113,"kind":"region","startCharacter":1,"startLine":111},{"endLine":121,"kind":"region","startCharacter":1,"startLine":118},{"endLine":127,"kind":"region","startCharacter":1,"startLine":125}]}
And navigating the file:
V[20:39:55.754] <<< {"id":43,"jsonrpc":"2.0","method":"textDocument/documentHighlight","params":{"position":{"character":37,"line":23},"textDocument":{"uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}}
I[20:39:55.754] <-- textDocument/documentHighlight(43)
I[20:39:55.754] --> reply:textDocument/documentHighlight(43) 0 ms, error: invalid AST
V[20:39:55.754] >>> {"error":{"code":-32001,"message":"invalid AST"},"id":43,"jsonrpc":"2.0"}
I[20:39:55.754] --> textDocument/clangd.fileStatus
V[20:39:55.754] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}
[Error - 8:39:55 PM] Request textDocument/documentHighlight failed.
[object Object]
V[20:39:56.089] <<< {"id":44,"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[],"triggerKind":2},"range":{"end":{"character":37,"line":23},"start":{"character":37,"line":23}},"textDocument":{"uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}}
I[20:39:56.089] <-- textDocument/codeAction(44)
I[20:39:56.089] --> reply:textDocument/codeAction(44) 0 ms, error: invalid AST
V[20:39:56.089] >>> {"error":{"code":-32001,"message":"invalid AST"},"id":44,"jsonrpc":"2.0"}
I[20:39:56.089] --> textDocument/clangd.fileStatus
V[20:39:56.090] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}
[Error - 8:39:56 PM] Request textDocument/codeAction failed.
[object Object]
V[20:39:56.814] <<< {"id":45,"jsonrpc":"2.0","method":"textDocument/hover","params":{"position":{"character":24,"line":22},"textDocument":{"uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}}
I[20:39:56.814] <-- textDocument/hover(45)
I[20:39:56.814] --> reply:textDocument/hover(45) 0 ms, error: invalid AST
V[20:39:56.814] >>> {"error":{"code":-32001,"message":"invalid AST"},"id":45,"jsonrpc":"2.0"}
I[20:39:56.814] --> textDocument/clangd.fileStatus
V[20:39:56.814] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}
[Error - 8:39:56 PM] Request textDocument/hover failed.
[object Object]
V[20:40:25.943] <<< {"id":46,"jsonrpc":"2.0","method":"textDocument/hover","params":{"position":{"character":39,"line":27},"textDocument":{"uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}}
I[20:40:25.943] <-- textDocument/hover(46)
I[20:40:25.943] --> reply:textDocument/hover(46) 0 ms, error: invalid AST
V[20:40:25.943] >>> {"error":{"code":-32001,"message":"invalid AST"},"id":46,"jsonrpc":"2.0"}
I[20:40:25.943] --> textDocument/clangd.fileStatus
V[20:40:25.943] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}
[Error - 8:40:25 PM] Request textDocument/hover failed.
[object Object]
V[20:40:26.475] <<< {"id":47,"jsonrpc":"2.0","method":"textDocument/hover","params":{"position":{"character":27,"line":23},"textDocument":{"uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}}
I[20:40:26.475] <-- textDocument/hover(47)
I[20:40:26.475] --> reply:textDocument/hover(47) 0 ms, error: invalid AST
V[20:40:26.475] >>> {"error":{"code":-32001,"message":"invalid AST"},"id":47,"jsonrpc":"2.0"}
I[20:40:26.475] --> textDocument/clangd.fileStatus
V[20:40:26.475] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}
[Error - 8:40:26 PM] Request textDocument/hover failed.
[object Object]
V[20:40:27.794] <<< {"id":48,"jsonrpc":"2.0","method":"textDocument/hover","params":{"position":{"character":38,"line":27},"textDocument":{"uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}}
I[20:40:27.794] <-- textDocument/hover(48)
I[20:40:27.794] --> reply:textDocument/hover(48) 0 ms, error: invalid AST
V[20:40:27.794] >>> {"error":{"code":-32001,"message":"invalid AST"},"id":48,"jsonrpc":"2.0"}
I[20:40:27.794] --> textDocument/clangd.fileStatus
V[20:40:27.794] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}
[Error - 8:40:27 PM] Request textDocument/hover failed.
[object Object]
V[20:40:38.888] <<< {"id":49,"jsonrpc":"2.0","method":"textDocument/documentHighlight","params":{"position":{"character":28,"line":27},"textDocument":{"uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}}
I[20:40:38.888] <-- textDocument/documentHighlight(49)
I[20:40:38.888] --> reply:textDocument/documentHighlight(49) 0 ms, error: invalid AST
V[20:40:38.888] >>> {"error":{"code":-32001,"message":"invalid AST"},"id":49,"jsonrpc":"2.0"}
[Error - 8:40:38 PM] Request textDocument/documentHighlight failed.
[object Object]
I[20:40:38.888] --> textDocument/clangd.fileStatus
V[20:40:38.889] Released memory via malloc_trim
V[20:40:38.889] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}
V[20:40:39.176] <<< {"id":50,"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[],"triggerKind":2},"range":{"end":{"character":28,"line":27},"start":{"character":28,"line":27}},"textDocument":{"uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}}
I[20:40:39.176] <-- textDocument/codeAction(50)
I[20:40:39.176] --> reply:textDocument/codeAction(50) 0 ms, error: invalid AST
V[20:40:39.176] >>> {"error":{"code":-32001,"message":"invalid AST"},"id":50,"jsonrpc":"2.0"}
I[20:40:39.176] --> textDocument/clangd.fileStatus
V[20:40:39.176] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}
[Error - 8:40:39 PM] Request textDocument/codeAction failed.
[object Object]
V[20:40:39.204] <<< {"id":51,"jsonrpc":"2.0","method":"textDocument/hover","params":{"position":{"character":27,"line":27},"textDocument":{"uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}}
I[20:40:39.204] <-- textDocument/hover(51)
I[20:40:39.204] --> reply:textDocument/hover(51) 0 ms, error: invalid AST
V[20:40:39.204] >>> {"error":{"code":-32001,"message":"invalid AST"},"id":51,"jsonrpc":"2.0"}
I[20:40:39.204] --> textDocument/clangd.fileStatus
V[20:40:39.204] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}
[Error - 8:40:39 PM] Request textDocument/hover failed.
[object Object]
V[20:40:39.360] <<< {"id":52,"jsonrpc":"2.0","method":"textDocument/definition","params":{"position":{"character":27,"line":27},"textDocument":{"uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}}
I[20:40:39.360] <-- textDocument/definition(52)
I[20:40:39.360] --> reply:textDocument/definition(52) 0 ms, error: invalid AST
V[20:40:39.360] >>> {"error":{"code":-32001,"message":"invalid AST"},"id":52,"jsonrpc":"2.0"}
I[20:40:39.360] --> textDocument/clangd.fileStatus
V[20:40:39.360] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}
[Error - 8:40:39 PM] Request textDocument/definition failed.
[object Object]
V[20:40:39.729] <<< {"id":53,"jsonrpc":"2.0","method":"textDocument/definition","params":{"position":{"character":27,"line":27},"textDocument":{"uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}}
I[20:40:39.729] <-- textDocument/definition(53)
I[20:40:39.729] --> reply:textDocument/definition(53) 0 ms, error: invalid AST
V[20:40:39.729] >>> {"error":{"code":-32001,"message":"invalid AST"},"id":53,"jsonrpc":"2.0"}
I[20:40:39.729] --> textDocument/clangd.fileStatus
V[20:40:39.729] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}
[Error - 8:40:39 PM] Request textDocument/definition failed.
[object Object]
V[20:40:39.858] <<< {"id":54,"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[],"triggerKind":2},"range":{"end":{"character":27,"line":27},"start":{"character":27,"line":27}},"textDocument":{"uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}}
I[20:40:39.858] <-- textDocument/codeAction(54)
I[20:40:39.858] --> reply:textDocument/codeAction(54) 0 ms, error: invalid AST
V[20:40:39.858] >>> {"error":{"code":-32001,"message":"invalid AST"},"id":54,"jsonrpc":"2.0"}
I[20:40:39.858] --> textDocument/clangd.fileStatus
V[20:40:39.858] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///user/home/work/project-dir/main/infra/iovec/stream_private.inc"}}
[Error - 8:40:39 PM] Request textDocument/codeAction failed.
[object Object]
Upvotes: 0
Views: 140
Reputation: 52847
You can use VSCode's "files.associations"
setting to associate this file extension with the C file type in your User or Workspace Settings:
"files.associations": {
"*.inc": "c"
}
EDIT: In addition, clangd needs to be told that the .inc
file should be parsed as a C header. This can be done by creating a .clangd
config file in your project's root directory containing:
If:
PathMatch: .*\.inc
CompileFlags:
Add: [-xc-header]
(Note, the indentation here is correct as written, it's just a bit of an unusual syntax: the If
applies to all subsequent entries until a ---
or the end of the file.)
Upvotes: 1