Vscode-cpptools: Frequent changes to workspace settings while working with C++ standard library

Created on 20 May 2020  路  3Comments  路  Source: microsoft/vscode-cpptools

Issue Type: LanguageService

C/C++: Auto Add File Associations setting has a side effect of changing workspace settings whenever user navigates to the C++ standard library headers.
e.g.:
"array": "cpp",
"istream": "cpp",
"tuple": "cpp",
"utility": "cpp",
"variant": "cpp"

This is a problem when the workspace settings are under version control.

A simple improvement would be to add the C++ standard library path to the associations. E.g.:

  "files.associations": {
        "**/include/c++/**": "cpp"
    }

Or the path to the given header, rather than every individual file name.

Extension version: 0.28.0
VS Code version: Code 1.45.1 (5763d909d5f12fe19f215cbfdd29a91c0fa9208a, 2020-05-14T08:27:22.494Z)
OS version: Linux x64 4.15.0-101-generic
Remote OS version: Linux x64 4.15.0-88-generic


System Info

|Item|Value|
|---|---|
|CPUs|AMD A8-4500M APU with Radeon(tm) HD Graphics (4 x 1644)|
|GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: disabled_software
skia_renderer: disabled_off_ok
video_decode: unavailable_off
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled|
|Load (avg)|1, 1, 1|
|Memory (System)|7.00GB (2.73GB free)|
|Process Argv|--no-sandbox --unity-launch|
|Screen Reader|no|
|VM|0%|
|DESKTOP_SESSION|xfce|
|XDG_CURRENT_DESKTOP|XFCE|
|XDG_SESSION_DESKTOP|xfce|
|XDG_SESSION_TYPE|x11|

|Item|Value|
|---|---|
|Remote|SSH: viavi-reverse-ssh|
|OS|Linux x64 4.15.0-88-generic|
|CPUs|Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz (8 x 1697)|
|Memory (System)|31.31GB (7.96GB free)|
|VM|0%|


Configuration Language Service enhancement help wanted

Most helpful comment

Adding that particular system path would only work on certain Linux OS's, but adding a glob pattern using the 2 parent folders might work. Might be fixable via changes to addFileAssociations at https://github.com/microsoft/vscode-cpptools/blob/master/Extension/src/LanguageServer/client.ts#L2008 .

All 3 comments

It seems to be an intended effect of this setting, enabled by default:

C_Cpp: Auto Add File Associations

Workaround

Can be avoided by adding a file association that captures C++ standard library headers like this:

    "files.associations": {
        "**/include/c++/**": "cpp"
    }

Adding that particular system path would only work on certain Linux OS's, but adding a glob pattern using the 2 parent folders might work. Might be fixable via changes to addFileAssociations at https://github.com/microsoft/vscode-cpptools/blob/master/Extension/src/LanguageServer/client.ts#L2008 .

Was this page helpful?
0 / 5 - 0 ratings