Skip to content

Commit

Permalink
tools: add clangd support (#9772)
Browse files Browse the repository at this point in the history
* tools: add clangd support
* [tools] use pip install scons
* [tools/vsc] fix path for in windows and linux
  • Loading branch information
supperthomas authored Dec 12, 2024
1 parent 4125582 commit b81d73e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
11 changes: 10 additions & 1 deletion tools/vsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b81d73e

Please sign in to comment.