tools: add clangd support (#9772)

* tools: add clangd support
* [tools] use pip install scons
* [tools/vsc] fix path for in windows and linux
This commit is contained in:
Supper Thomas 2024-12-12 09:49:43 +08:00 committed by GitHub
parent 4125582342
commit b81d73e847
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View File

@ -9,7 +9,7 @@ RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y vim git wget python3 python-is-python3 pip gcc-arm-none-eabi scons libncurses5-dev
RUN apt-get install -y vim git wget python3 python-is-python3 pip gcc-arm-none-eabi libncurses5-dev
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y qemu-system-arm
@ -34,7 +34,7 @@ RUN git clone https://github.com/RT-Thread/packages.git /root/.env/packages/pack
ENV PATH="/root/.env/tools/scripts:$PATH"
RUN pip install requests psutil kconfiglib tqdm -qq
RUN pip install scons requests psutil kconfiglib tqdm -qq
ENV RTT_EXEC_PATH=/usr/bin

View File

@ -108,8 +108,17 @@ def GenerateCFiles(env):
target_path_list = []
for path in path_list:
if path['path'] != '.':
path['name'] = 'rtthread/' + '/'.join([p for p in path['path'].split('\\') if p != '..'])
normalized_path = path['path'].replace('\\', os.path.sep)
segments = [p for p in normalized_path.split(os.path.sep) if p != '..']
path['name'] = 'rtthread/' + '/'.join(segments)
json_obj['folders'] = path_list
if os.path.exists('compile_commands.json'):
json_obj['settings'] = {
"clangd.arguments": [
"--compile-commands-dir=.",
"--header-insertion=never"
]
}
vsc_space_file.write(json.dumps(json_obj, ensure_ascii=False, indent=4))
vsc_space_file.close()
return