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:
parent
4125582342
commit
b81d73e847
|
@ -9,7 +9,7 @@ RUN apt-get update
|
||||||
|
|
||||||
RUN apt-get upgrade -y
|
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
|
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"
|
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
|
ENV RTT_EXEC_PATH=/usr/bin
|
||||||
|
|
||||||
|
|
11
tools/vsc.py
11
tools/vsc.py
|
@ -108,8 +108,17 @@ def GenerateCFiles(env):
|
||||||
target_path_list = []
|
target_path_list = []
|
||||||
for path in path_list:
|
for path in path_list:
|
||||||
if path['path'] != '.':
|
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
|
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.write(json.dumps(json_obj, ensure_ascii=False, indent=4))
|
||||||
vsc_space_file.close()
|
vsc_space_file.close()
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue