Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
490fc7504f | ||
|
|
f2959f4d7a | ||
|
|
d7520eacf3 | ||
|
|
e17de19810 | ||
|
|
4be65505a4 | ||
|
|
918faeae44 | ||
|
|
423a727fcf | ||
|
|
1ad20e18a2 | ||
|
|
bb43c500c2 | ||
|
|
4ae01b6d4b | ||
|
|
59af571d61 | ||
|
|
355711c24c | ||
|
|
c7b6f3c554 | ||
|
|
c31528b716 | ||
|
|
655c320c3c | ||
|
|
5e915a5a3a | ||
|
|
27607493d8 | ||
|
|
b80404df5a | ||
|
|
f2d9aff338 | ||
|
|
6bc6d4931d | ||
|
|
b7bd343019 | ||
|
|
1a71059316 | ||
|
|
d9ca558f74 | ||
|
|
c9a114b38f | ||
|
|
44298673fc | ||
|
|
c9869894de | ||
|
|
41893b049d | ||
|
|
e9659f2c6e | ||
|
|
7f9e5758bc | ||
|
|
03fa10fbd1 | ||
|
|
d3d9655534 | ||
|
|
586068e874 | ||
|
|
8e69cde774 | ||
|
|
ba2da8d98c | ||
|
|
007292cbda | ||
|
|
b608921b9d | ||
|
|
8e31eb99d9 | ||
|
|
ceac5cb95a | ||
|
|
14f2c9f030 | ||
|
|
3d40ac231a | ||
|
|
baf6f50be3 | ||
|
|
d9de95ca15 | ||
|
|
2b3d2ac541 | ||
|
|
4b4c93cd94 | ||
|
|
fa4d7b22c1 | ||
|
|
3cb7f7e61f | ||
|
|
779f2ce2b5 | ||
|
|
0c4c83e5bd | ||
|
|
a369ede8d9 | ||
|
|
36ce8f885f | ||
|
|
2cde4d6f1a | ||
|
|
066c8f1247 | ||
|
|
347794b0c7 | ||
|
|
4495d0b26d | ||
|
|
b1d50e4336 | ||
|
|
cb035dd1f2 | ||
|
|
3faaca14c0 | ||
|
|
53107bc57c | ||
|
|
d38740c098 | ||
|
|
ccc18a6f66 | ||
|
|
e26cae6838 | ||
|
|
9ea53681a5 | ||
|
|
3ed087134c | ||
|
|
902355e021 | ||
|
|
32e98912df | ||
|
|
6bc49d595e | ||
|
|
6b3c0f1b10 | ||
|
|
35501431f8 | ||
|
|
27a3c9958d | ||
|
|
5b3d4ebf44 | ||
|
|
cfc064efcd | ||
|
|
4f7a64a1a2 | ||
|
|
c84cb36004 | ||
|
|
0502351002 | ||
|
|
5de420ee70 | ||
|
|
6a73275924 | ||
|
|
d12591062e | ||
|
|
3926110b33 | ||
|
|
f5975e6534 | ||
|
|
b55e2c7ac5 | ||
|
|
73fda38d71 | ||
|
|
9211292b60 | ||
|
|
f63a8da581 | ||
|
|
fd314b1b04 | ||
|
|
ea52c76595 | ||
|
|
7659e2826b | ||
|
|
8e898151f6 | ||
|
|
b2b0ad37af | ||
|
|
cee6ebe1d9 | ||
|
|
566e657fad | ||
|
|
db1f631396 | ||
|
|
426c08293d | ||
|
|
631a4452d0 | ||
|
|
9b29698b0e | ||
|
|
b5c94e9e1f | ||
|
|
384cd35d6b | ||
|
|
2d4df9149f | ||
|
|
d3c2ccbb93 | ||
|
|
c637221b92 | ||
|
|
814f01b263 | ||
|
|
b763aa57d3 | ||
|
|
54b1e69975 | ||
|
|
dacfe08033 | ||
|
|
f5aa7dc33e | ||
|
|
90c6e9876a | ||
|
|
9fa950db6a | ||
|
|
8ea627e085 | ||
|
|
536d38e3bf | ||
|
|
c10c626869 | ||
|
|
24d37bc233 | ||
|
|
158719cf46 | ||
|
|
b6327ed6c3 | ||
|
|
c60a2c6752 | ||
|
|
1f7c27d7f9 | ||
|
|
1d82458a3a | ||
|
|
25d122c3f7 | ||
|
|
627acc535e | ||
|
|
515d858b4d | ||
|
|
7ec15af47c | ||
|
|
cac58e9f88 | ||
|
|
0c28725628 | ||
|
|
084a8e708c | ||
|
|
045d50bb90 | ||
|
|
68eda19665 | ||
|
|
ae564c8428 | ||
|
|
5241ce28e0 | ||
|
|
febb880e32 | ||
|
|
d1c344b944 | ||
|
|
a19d1c325e | ||
|
|
82225338c4 | ||
|
|
fa72ab582d | ||
|
|
0b3e43c93f | ||
|
|
8b332a7795 | ||
|
|
39ab866a10 | ||
|
|
d4cdfe6994 | ||
|
|
4e20f27127 | ||
|
|
4e2f1b8ba5 | ||
|
|
0cffa4e27a | ||
|
|
b67e701fc9 | ||
|
|
77f3747630 | ||
|
|
dc8813f449 | ||
|
|
e0543a64c1 | ||
|
|
e5b118c707 | ||
|
|
f465766d1e | ||
|
|
7f4fc339c7 | ||
|
|
788cee3ecf | ||
|
|
05939c19a9 | ||
|
|
110e683790 | ||
|
|
6a88c9917b | ||
|
|
2ac33971ed | ||
|
|
a5905276ce | ||
|
|
d6726e5d42 | ||
|
|
aa6873b84e | ||
|
|
e3ddec66ee | ||
|
|
26d83d136e | ||
|
|
6f4439ca88 | ||
|
|
3fbeba779c | ||
|
|
cfc908a1ac | ||
|
|
f3a02fde4e | ||
|
|
e863e88e95 | ||
|
|
bc70ea8c79 | ||
|
|
bbfea25a1d | ||
|
|
968d6c5919 | ||
|
|
33d23b3a5e | ||
|
|
4bf3691f7f | ||
|
|
bf9d69a8ad | ||
|
|
9a78289fec | ||
|
|
7960904575 | ||
|
|
dd590ea1f5 | ||
|
|
5d1e503480 | ||
|
|
3b15f515d1 | ||
|
|
d7a3384a07 | ||
|
|
4cdcd72990 | ||
|
|
740705973e | ||
|
|
3a78e96785 | ||
|
|
39b89bdb5b | ||
|
|
d4d68cb808 | ||
|
|
d3e8958b29 | ||
|
|
0e3fea978a | ||
|
|
a39b1a5d6c | ||
|
|
f15994a58c | ||
|
|
009c77d45f | ||
|
|
94e213449f | ||
|
|
7ae6818bfb | ||
|
|
03a6c04629 | ||
|
|
8526bc90cb | ||
|
|
105760833d | ||
|
|
239e4015d6 | ||
|
|
7e7b38acd7 | ||
|
|
260dc5d840 | ||
|
|
99b290513b | ||
|
|
76b3d9ca28 | ||
|
|
806dc8ac43 | ||
|
|
03cf4d7aaf | ||
|
|
569a7cb53d | ||
|
|
6de2250fef | ||
|
|
ae861b3605 | ||
|
|
2aeadbd395 | ||
|
|
0b500cefb7 | ||
|
|
2e8cd7f406 | ||
|
|
8c8c2c22e3 | ||
|
|
bdc8322da3 | ||
|
|
eeb2ba207c | ||
|
|
f848bf392a | ||
|
|
f72a3ded96 | ||
|
|
31b993941b | ||
|
|
59b0b3f924 | ||
|
|
5b90fc6bd3 | ||
|
|
a4e9df0e6e | ||
|
|
3ef0b7597f | ||
|
|
74c9b0b967 | ||
|
|
3b5a8466d7 | ||
|
|
fbf8ed4e35 | ||
|
|
c978eb0755 | ||
|
|
0f67f54b42 | ||
|
|
b770030ec2 | ||
|
|
8129ce337e | ||
|
|
93a88c948a | ||
|
|
34d8874754 | ||
|
|
0773ec8c41 | ||
|
|
9f842ac0d9 | ||
|
|
e8d0ded816 | ||
|
|
f5bdac9889 | ||
|
|
eb976d5ca5 | ||
|
|
d5a902e144 | ||
|
|
b0c2d54144 | ||
|
|
bcdabc9c36 | ||
|
|
e054287c48 | ||
|
|
dcf480990b | ||
|
|
02a3152f0f | ||
|
|
77806f657f | ||
|
|
7e5f22f862 | ||
|
|
0f8e7b2d7b | ||
|
|
088276b4af | ||
|
|
a7cefc9d4d | ||
|
|
30d8a1daa4 | ||
|
|
148ae1d325 | ||
|
|
968ce8acba | ||
|
|
ff6e13e829 | ||
|
|
c18592b5a3 | ||
|
|
fee924b374 | ||
|
|
6724e13c63 | ||
|
|
798e90574c | ||
|
|
1eb064e020 | ||
|
|
717de54b06 | ||
|
|
51cd214f1e | ||
|
|
4ca9ad8b3a | ||
|
|
8aadd40a58 | ||
|
|
7088f546aa | ||
|
|
64ca48b50e | ||
|
|
0c61ee96b7 | ||
|
|
e020801dac | ||
|
|
270a4f7d38 | ||
|
|
342de46452 | ||
|
|
cd0dde9e27 | ||
|
|
79f8262d26 | ||
|
|
24b69c7873 | ||
|
|
260124b39b | ||
|
|
2426a66be4 | ||
|
|
6f5c9e362b | ||
|
|
868799af10 | ||
|
|
01d013723f | ||
|
|
1a8e84bca3 | ||
|
|
3db3c8da9a | ||
|
|
670a105c1f | ||
|
|
5445eff250 | ||
|
|
95dd5386ed | ||
|
|
55120359a4 | ||
|
|
bb2d23c694 | ||
|
|
15ac01d70c | ||
|
|
0c77b9e6cf | ||
|
|
c39579010b | ||
|
|
e928bfb0a9 | ||
|
|
1d47bc4160 | ||
|
|
3d7937feeb | ||
|
|
98260f96ea | ||
|
|
8d96465cb6 | ||
|
|
ece90711fb | ||
|
|
361ca45b50 | ||
|
|
28e8f1f2ed | ||
|
|
d27e609d92 | ||
|
|
fdcbfee87c | ||
|
|
bda5bbf89c | ||
|
|
50ddd670c7 | ||
|
|
cc81b4bb8f | ||
|
|
a0f6eb61ad | ||
|
|
10a06af93d | ||
|
|
b28ab0a874 | ||
|
|
f1ca548849 | ||
|
|
f860223723 | ||
|
|
e2aaababc4 | ||
|
|
49aa55261f | ||
|
|
035d0284d9 | ||
|
|
f216e0262a | ||
|
|
373e9be4cb | ||
|
|
7a20270b10 | ||
|
|
41a4e14e4c | ||
|
|
13b78f2129 | ||
|
|
bf6b4aa54e | ||
|
|
f978719dea | ||
|
|
2713e70563 | ||
|
|
af516b9515 | ||
|
|
243f21380d | ||
|
|
da277c8593 | ||
|
|
6fc9f7b682 | ||
|
|
b3cce807bb | ||
|
|
a533eb9a43 | ||
|
|
9702eae953 | ||
|
|
a4b51997ff | ||
|
|
ec9270f5a9 | ||
|
|
75f35a1fd7 | ||
|
|
dcc0174133 | ||
|
|
3b8c3143e4 | ||
|
|
33e7d70324 | ||
|
|
703e23a62b | ||
|
|
39ba7fc6ba | ||
|
|
6488a11dc3 | ||
|
|
5ca48e24cf | ||
|
|
de9cc715fc | ||
|
|
c727ceca1b | ||
|
|
f58af4fb2e | ||
|
|
7935b97329 | ||
|
|
bd6f8f0df3 | ||
|
|
4b22333f5c | ||
|
|
968e0d2aae | ||
|
|
8dc8b3bc37 | ||
|
|
bb962b91e8 | ||
|
|
8c53c027ca | ||
|
|
b864126494 | ||
|
|
b78e85619a | ||
|
|
f474ba8539 | ||
|
|
0f1071a5c9 | ||
|
|
f69e6e191b | ||
|
|
230895d6ba | ||
|
|
fa8173076d | ||
|
|
3079fb58ae | ||
|
|
9f1b482de4 | ||
|
|
8f6714254a | ||
|
|
5246cdc527 | ||
|
|
4938f5b2f4 | ||
|
|
21fef3b067 | ||
|
|
71582d1883 | ||
|
|
23fc338f71 | ||
|
|
4a8b143ce0 | ||
|
|
b1274d3c76 | ||
|
|
8f8565dbfd | ||
|
|
7f4614c31c | ||
|
|
eccee49017 | ||
|
|
e231453778 | ||
|
|
8729804dc2 | ||
|
|
c607604b6b | ||
|
|
460b95920f | ||
|
|
1c38b55b9f | ||
|
|
0cf237c839 | ||
|
|
e12bad5172 | ||
|
|
04bb260577 | ||
|
|
ddc1f901c2 | ||
|
|
9ca27af2df | ||
|
|
b964d4ebc4 | ||
|
|
082435ec8b | ||
|
|
324c5f59f4 | ||
|
|
72581c23b7 | ||
|
|
807ff80f56 | ||
|
|
b0e17a1fd9 | ||
|
|
bc64d25a1d | ||
|
|
ed5d8c8fac | ||
|
|
3a9f4c404d | ||
|
|
4330679e23 | ||
|
|
88e9724892 | ||
|
|
acf7b464eb | ||
|
|
78f5a38110 | ||
|
|
31eed4cee2 | ||
|
|
ea8ab1358f | ||
|
|
55558a53e3 | ||
|
|
536685c8a0 | ||
|
|
b6f184744c | ||
|
|
539ecc536f | ||
|
|
e819f36e91 | ||
|
|
140670c371 | ||
|
|
102ffc1616 | ||
|
|
28981f3ce6 | ||
|
|
775aba8650 | ||
|
|
b3fb2558fd | ||
|
|
80716ae228 | ||
|
|
6d71c6dd4f | ||
|
|
da68908e3e | ||
|
|
963ee02117 | ||
|
|
45a1804da4 | ||
|
|
f66eb138f4 | ||
|
|
da862646c3 | ||
|
|
1bcaa540b6 | ||
|
|
96e3386288 | ||
|
|
862a10f3f8 | ||
|
|
2e62382b24 | ||
|
|
5f9ef54c54 | ||
|
|
4575e2840e | ||
|
|
a9a09dcd11 | ||
|
|
e0e7944f3a | ||
|
|
63e18afcf1 | ||
|
|
fcdcd80157 | ||
|
|
126cf7cef6 | ||
|
|
ad451bb438 | ||
|
|
83be111769 | ||
|
|
2f931d930d | ||
|
|
bc6cb3e55f | ||
|
|
f44e9068ca | ||
|
|
c206a4b88c | ||
|
|
9e95e412a8 | ||
|
|
86ce6c6115 | ||
|
|
ecd3eb24f4 | ||
|
|
25e29a01c2 | ||
|
|
e9b8ad66a1 | ||
|
|
3e5a6aae80 | ||
|
|
49fea0249d | ||
|
|
7de9956a92 | ||
|
|
9abf44b7ac | ||
|
|
daaf169c8a | ||
|
|
23d94452bb | ||
|
|
705122a168 | ||
|
|
757f1f94be | ||
|
|
7fe2db1202 | ||
|
|
d8738c3e0c | ||
|
|
b1bd33b8f4 | ||
|
|
436c483d35 | ||
|
|
99bd382707 | ||
|
|
356bb903d0 | ||
|
|
b0fc9427cf | ||
|
|
60b20dce8d | ||
|
|
906fd2d8f0 | ||
|
|
4afadad93b | ||
|
|
3790fa95e7 | ||
|
|
a0882446d9 | ||
|
|
ce59810a6d | ||
|
|
770013d77e | ||
|
|
2388fa97f4 | ||
|
|
3381cde61c | ||
|
|
3a46f10d97 | ||
|
|
2b4b5d397d | ||
|
|
c36eb8e7b1 | ||
|
|
ad46d3887a | ||
|
|
8b704f5972 | ||
|
|
1009b76b22 | ||
|
|
84ff661e15 | ||
|
|
2292e7d762 | ||
|
|
c8e30c70b1 | ||
|
|
7947dd80d6 | ||
|
|
913f740cc2 | ||
|
|
2cbc90d98b | ||
|
|
25a29d0bc3 | ||
|
|
052f4e7b39 | ||
|
|
2b245202b5 | ||
|
|
15c6c0a50e | ||
|
|
a0e0254c73 | ||
|
|
528905326f | ||
|
|
458b2be489 | ||
|
|
95d4724dc8 | ||
|
|
a178faab9b | ||
|
|
25aa8206a0 | ||
|
|
879d880c82 | ||
|
|
16c4defcd0 | ||
|
|
725828c1c5 | ||
|
|
8b188541ba | ||
|
|
28f1bc991e | ||
|
|
aa424f1946 | ||
|
|
130711f4c5 | ||
|
|
863d26451c | ||
|
|
0a85b6c115 | ||
|
|
f2b3bd5a18 | ||
|
|
ab3e498c17 | ||
|
|
bfad3045bd | ||
|
|
842e685a6a | ||
|
|
3b36a23956 | ||
|
|
bf7287e70b | ||
|
|
63ce03573c | ||
|
|
9ddf1098f7 | ||
|
|
56f4be1f65 | ||
|
|
3b6dc61562 | ||
|
|
b8a15ddfe6 | ||
|
|
f3e188c0ce | ||
|
|
d403c8f984 | ||
|
|
35288aad17 | ||
|
|
4b90e4c151 | ||
|
|
cc85f3d7c3 | ||
|
|
fbbe28458a | ||
|
|
0d80edba3d | ||
|
|
76870c637c |
@@ -6,9 +6,14 @@ about: Issues pertaining to debugging such as call stack, breakpoints, watch win
|
||||
---
|
||||
|
||||
Type: Debugger
|
||||
**Input information below**
|
||||
<!----- Input information below ----->
|
||||
|
||||
**Please review existing issues and our documentation at https://github.com/Microsoft/vscode-cpptools/tree/master/Documentation prior to filing an issue.**
|
||||
<!--
|
||||
**Prior to filing an issue, please review:**
|
||||
- Existing issues at https://github.com/Microsoft/vscode-cpptools/issues
|
||||
- Our documentation at https://code.visualstudio.com/docs/languages/cpp
|
||||
- FAQs at https://code.visualstudio.com/docs/cpp/faq-cpp
|
||||
-->
|
||||
|
||||
**Describe the bug**
|
||||
- OS and Version:
|
||||
|
||||
@@ -5,9 +5,14 @@ about: Issues pertaining to downloading, installing, or building the extension.
|
||||
---
|
||||
|
||||
Type: General
|
||||
**Input information below**
|
||||
<!----- Input information below ----->
|
||||
|
||||
**Please review existing issues and our documentation at https://github.com/Microsoft/vscode-cpptools/tree/master/Documentation prior to filing an issue.**
|
||||
<!--
|
||||
**Prior to filing an issue, please review:**
|
||||
- Existing issues at https://github.com/Microsoft/vscode-cpptools/issues
|
||||
- Our documentation at https://code.visualstudio.com/docs/languages/cpp
|
||||
- FAQs at https://code.visualstudio.com/docs/cpp/faq-cpp
|
||||
-->
|
||||
|
||||
**Describe the bug**
|
||||
- OS and Version:
|
||||
|
||||
@@ -4,10 +4,15 @@ about: 'Issues pertaining to IntelliSense, autocomplete, code editing, etc. '
|
||||
|
||||
---
|
||||
|
||||
Type: LanguageService
|
||||
**----- Input information below -----**
|
||||
**Type: LanguageService**
|
||||
<!----- Input information below ----->
|
||||
|
||||
**Please review existing issues and our documentation at https://github.com/Microsoft/vscode-cpptools/tree/master/Documentation prior to filing an issue.**
|
||||
<!--
|
||||
**Prior to filing an issue, please review:**
|
||||
- Existing issues at https://github.com/Microsoft/vscode-cpptools/issues
|
||||
- Our documentation at https://code.visualstudio.com/docs/languages/cpp
|
||||
- FAQs at https://code.visualstudio.com/docs/cpp/faq-cpp
|
||||
-->
|
||||
|
||||
**Describe the bug**
|
||||
- OS and Version:
|
||||
@@ -17,19 +22,21 @@ Type: LanguageService
|
||||
- A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
*Provide a code sample including configuration files such as c_cpp_properties.json*
|
||||
<!-- Steps to reproduce the behavior: -->
|
||||
<!-- *The most actionable issue reports include a code sample including configuration files such as c_cpp_properties.json* -->
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
<!-- A clear and concise description of what you expected to happen. -->
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
<!-- If applicable, add screenshots to help explain your problem. -->
|
||||
|
||||
**Additional context**
|
||||
*Call Stacks: For bugs like crashes, deadlocks, infinite loops, etc. that we are not able to repro and for which the call stack may be useful, please attach a debugger and/or create a dmp and provide the call stacks. Starting with 0.17.3, Windows binaries have symbols available in VS Code by setting your "symbolSearchPath" to "http://msdl.microsoft.com/download/symbols".*
|
||||
Add any other context about the problem here including log messages in your Output window ("C_Cpp.loggingLevel": "Debug" in settings.json).
|
||||
<!--
|
||||
* Call Stacks: For bugs like crashes, deadlocks, infinite loops, etc. that we are not able to repro and for which the call stack may be useful, please attach a debugger and/or create a dmp and provide the call stacks. Windows binaries have symbols available in VS Code by setting your "symbolSearchPath" to "https://msdl.microsoft.com/download/symbols".
|
||||
* Add any other context about the problem here including log messages in your Output window ("C_Cpp.loggingLevel": "Debug" in settings.json).
|
||||
-->
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# ignore cache files for sample projects
|
||||
.vscode/ipch
|
||||
browse*.db*
|
||||
*.obj
|
||||
*.pdb
|
||||
*.exe
|
||||
*.ilk
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "8"
|
||||
|
||||
before_install:
|
||||
# Do not modify. Required for GUI based tests: See https://docs.travis-ci.com/user/gui-and-headless-browsers/#Using-xvfb-to-Run-Tests-That-Require-a-GUI
|
||||
- if [ $TRAVIS_OS_NAME == "linux" ]; then
|
||||
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
|
||||
sh -e /etc/init.d/xvfb start;
|
||||
sleep 3;
|
||||
fi
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- sourceline: 'deb https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main'
|
||||
key_url: 'https://packages.microsoft.com/keys/microsoft.asc'
|
||||
packages:
|
||||
- gdb
|
||||
- g++-4.9
|
||||
|
||||
|
||||
script:
|
||||
# Download debugAdapters from an existing extension version. See TravisCI settings to set CPPTOOL_VERSION
|
||||
- mkdir -p ~/.vscode/extensions/ms-vscode.cpptools-$CPPTOOL_VERSION
|
||||
- wget https://github.com/Microsoft/vscode-cpptools/releases/download/$CPPTOOL_VERSION/cpptools.vsix -O ~/cpptools.vsix
|
||||
- unzip ~/cpptools.vsix "extension/debugAdapters/*" -d ~/.
|
||||
- mv ~/extension/debugAdapters ~/.vscode/extensions/ms-vscode.cpptools-$CPPTOOL_VERSION/debugAdapters
|
||||
# Build and then run tests
|
||||
- cd Extension
|
||||
- npm install
|
||||
- npm run compile
|
||||
- npm run tslint
|
||||
# pr-check needs to run before test. test modifies package.json.
|
||||
- npm run pr-check
|
||||
- npm run test
|
||||
# Dump integrationTest.log output
|
||||
- find ~ -name "integrationTests.log" -type f -exec cat {} \;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef BOX_H
|
||||
#define BOX_H
|
||||
|
||||
/**
|
||||
* Definition of a box object with three dimensions.
|
||||
*/
|
||||
struct box
|
||||
{
|
||||
int length;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
int volume()
|
||||
{
|
||||
return length * width * height;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,24 @@
|
||||
# Box Sample
|
||||
This sample is a simple C++ program that computes and outputs the volume of a box.
|
||||
|
||||
We use this example in our blog posts to illustrate new extension features.
|
||||
|
||||
## Build and Debug Active File
|
||||
Available as of March 2019, "Build and Debug Active File" automatically configures the build tasks and kicks off a build and debug session. There are
|
||||
three ways to get started with this feature.
|
||||
|
||||
### Command
|
||||
While editing a file in your workspace folder, you can open the command palette and select the `C/C++: Build and Debug Active File` command.
|
||||
This option will generate a tasks.json file for you, build your active source file, and then launch the debugger.
|
||||
|
||||

|
||||
|
||||
### Context Menu
|
||||
While editing a file in a workspace folder, you can right click in the editor field and select the "Build and Debug Active File" context menu option.
|
||||
This option will generate a tasks.json file for you, build your active source file, and then launch the debugger.
|
||||
|
||||

|
||||
|
||||
### F5
|
||||
Another way to begin building and debugging your active file is to execute the command by pressing <kbd>F5</kbd>. This method will configure
|
||||
both a tasks.json and launch.json file for you, build your active source file, and then launch the debugger.
|
||||
@@ -0,0 +1,16 @@
|
||||
#include <iostream>
|
||||
#include "Objects/box.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* Calculate and print the volume of a box.
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
box package{ 10, 10, 10 };
|
||||
cout << "Package length: " << package.length << endl;
|
||||
cout << "Package width: " << package.width << endl;
|
||||
cout << "Package height: " << package.height << endl;
|
||||
cout << "Package volume: " << package.volume() << endl;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
Vendored
+2
-2
@@ -4,7 +4,7 @@
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"taskName": "build",
|
||||
"label": "build",
|
||||
"type": "shell",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
@@ -47,4 +47,4 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
main.exe
|
||||
main.exe.dSYM
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "(lldb) Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/main.exe", // this is executable to launch the debugger with
|
||||
"args": ["YourNameHere"],
|
||||
"stopAtEntry": true, // if true then stop at the main entry (function)
|
||||
"cwd": "${workspaceRoot}",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "lldb"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "clang++",
|
||||
"command": "clang++ --debug -o main.exe main.cpp",
|
||||
// "--debug" enables debugging symbols
|
||||
// "-o main.exe" specifies the output executable
|
||||
// "main.cpp" is the source file to compile
|
||||
"type": "shell",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
# README
|
||||
This is a sample debuggable C++ project. It uses the vendor provided version of clang installed. `tasks.json` and `launch.json` have been edited to demonstrate how to create a configuration for a C++ project that builds with clang.
|
||||
|
||||
There's a sample build task in `.vscode/tasks.json`; you can also see the build configurations by using the menu option `Configure` -> `Configure Tasks` or by clicking the gear icon in the Debug Panel.
|
||||
|
||||
To run a build, use the menu option `Tasks` -> `Run Build Task...`.
|
||||
|
||||
There's a sample debug configuration in `.vscode/launch.json`; you can also see the configuration by using the menu option `Debug` -> `Open Configurations`.
|
||||
|
||||
To debug the build, use the menu option `Debug` -> `Start Debugging`. The executable will launch and stop in the main function.
|
||||
@@ -1,17 +0,0 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void greet(const string& person) {
|
||||
cout << "Hello, " << person << "!" << endl;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if(argc >= 2) {
|
||||
greet(argv[1]);
|
||||
} else {
|
||||
cerr << "insufficient args, usage: " << argv[0] << " personNameHere" << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
## How to build and debug the Microsoft CppTools Extension
|
||||
|
||||
These steps will allow you to debug the TypeScript code that is part of the Microsoft CppTools extension for Visual Studio Code.
|
||||
|
||||
Prerequisite steps:
|
||||
* Clone [this](https://github.com/Microsoft/vscode-cpptools) repository.
|
||||
* Install [npm](https://nodejs.org).
|
||||
* From a command line, run the following commands from the **Extension** folder in the root of the repository:
|
||||
* `npm install -g vsce` will install `vsce` globally to create the vsix package.
|
||||
* `npm install` will install the dependencies needed to build the extension.
|
||||
* Set an environment variable `CPPTOOLS_DEV=1`.
|
||||
* This enables the local developer workflow, copying dependencies from the **node_modules** folder.
|
||||
* Open the **Extension** folder in Visual Studio Code and F5.
|
||||
* Read the [contributing guidelines](https://github.com/Microsoft/vscode-cpptools/blob/master/CONTRIBUTING.md).
|
||||
## How to build and debug the Microsoft CppTools Extension
|
||||
|
||||
These steps will allow you to debug the TypeScript code that is part of the Microsoft CppTools extension for Visual Studio Code.
|
||||
|
||||
Prerequisite steps:
|
||||
* Clone the release branch of [this](https://github.com/Microsoft/vscode-cpptools) repository.
|
||||
* git clone -b release https://github.com/Microsoft/vscode-cpptools
|
||||
* Install [npm](https://nodejs.org).
|
||||
* From a command line, run the following commands from the **Extension** folder in the root of the repository:
|
||||
* `npm install` will install the dependencies needed to build the extension.
|
||||
* **(optional)** `npm install -g vsce` will install `vsce` globally to create a VSIX package that you can install.
|
||||
* **(optional)** Set an environment variable `CPPTOOLS_DEV=1`.
|
||||
* This enables the local developer workflow when testing the debugger, copying dependencies from the **node_modules** folder. Testing the language server does not require this step.
|
||||
* Open the **Extension** folder in Visual Studio Code and press F5. This will launch a VS Code Extension Host window and activate the TypeScript debugger. You can set breakpoints on the extension source code and debug your scenario.
|
||||
|
||||
@@ -15,12 +15,13 @@ You can open the solution file **MIDebugEngine.sln** located under **src** and c
|
||||
* Microsoft.MIDebugEngine.dll
|
||||
* vscode\OpenDebugAD7.exe
|
||||
* vscode\Microsoft.DebugEngineHost.dll
|
||||
* vscode\Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.dll
|
||||
|
||||
The symbol files are as follows:
|
||||
|
||||
**On Windows**
|
||||
* Microsoft.MICore.pdb
|
||||
* Microsoft.MIDebugEngine.dll
|
||||
* Microsoft.MIDebugEngine.pdb
|
||||
* vscode\OpenDebugAD7.pdb
|
||||
* vscode\Microsoft.DebugEngineHost.pdb
|
||||
|
||||
@@ -51,11 +52,13 @@ This will cause the debugger to look like it has hung once you start debugging,
|
||||
|
||||
### Debugging MIEngine running on Linux or Mac OS X
|
||||
|
||||
#### With MonoDevelop
|
||||
|
||||
On Linux and Mac OS X, we use `mono` as our framework. You can download Xamarin Studio v5.10.1.6 and remotely attach to your Mac or Linux box to debug there.
|
||||
|
||||
#### Install Prerequisites
|
||||
1. Install [GTK](http://www.mono-project.com/download/)
|
||||
2. Install [Xamarin Studio v5.10.1.6](http://download.xamarin.com/studio/Windows/XamarinStudio-5.10.1.6-0.msi)
|
||||
##### Install Prerequisites
|
||||
1. Install [GTK](http://www.mono-project.com/download/).
|
||||
2. Install [Xamarin Studio v5.10.1.6](http://download.xamarin.com/studio/Windows/XamarinStudio-5.10.1.6-0.msi).
|
||||
|
||||
Remote attach functionality behind a flag. You can run it like this:
|
||||
```PowerShell
|
||||
@@ -64,26 +67,60 @@ set MONODEVELOP_SDB_TEST=1
|
||||
MonoDevelop.exe
|
||||
```
|
||||
|
||||
#### Create an empty project for attaching (one-time setup)
|
||||
##### Create an empty project for attaching (one-time setup)
|
||||
|
||||
1. Launch MonoDevelop
|
||||
2. File -> New Solution
|
||||
3. Misc/Generic Project
|
||||
4. Name project and hit "Create"
|
||||
5. Right-click the project node (blue square) and do "Options"
|
||||
1. Launch MonoDevelop.
|
||||
2. File -> New Solution.
|
||||
3. Misc/Generic Project.
|
||||
4. Name project and hit "Create".
|
||||
5. Right-click the project node (blue square) and do "Options".
|
||||
6. Under Run -> Custom Commands, select "Execute" in the lower dropdown and choose a command (I use `c:\windows\notepad.exe` - it doesn't matter what the command is, but MonoDevelop requires it to exist before it'll light up the Run menu).
|
||||
|
||||
#### Configure the extension to enable remote debugging
|
||||
##### Configure the extension to enable remote debugging
|
||||
|
||||
Open the **~/.vscode/extensions/ms-vscode.cpptools-\<version\>/debugAdapters/OpenDebugAD7** file with a text editor and locate and uncomment the line at the bottom. When you start debugging, it will now hang until the remote debugger is attached from Xamarin Studio.
|
||||
|
||||
#### Attach the remote debugger
|
||||
##### Attach the remote debugger
|
||||
|
||||
In MonoDevelop: Run -> Run With -> Custom Command Mono Soft Debugger
|
||||
Fill in the IP and port of the Linux/Mac OS X machine and hit "Connect" to start debugging
|
||||
In MonoDevelop: Run -> Run With -> Custom Command Mono Soft Debugger.
|
||||
Fill in the IP and port of the Linux/Mac OS X machine and hit "Connect" to start debugging.
|
||||
|
||||
After you've done this once, you can hit the MonoDevelop "Play" button or <kbd>F5</kbd> to bring up the connect dialog again.
|
||||
|
||||
Note: If you are debugging to CentOS, you will need to make an exception in the firewall
|
||||
#### With VS Code + Mono Debug
|
||||
|
||||
##### Install Prerequisites
|
||||
1. Install [VS Code](https://code.visualstudio.com/Download).
|
||||
2. Install Mono Debug extension for VS Code.
|
||||
|
||||
##### Create an empty project (one-time setup)
|
||||
1. Open to a new folder and create `.vscode/launch.json`.
|
||||
2. Create the following configuration in launch.json.
|
||||
```
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Attach to Mono",
|
||||
"request": "attach",
|
||||
"type": "mono",
|
||||
"address": "<INSERT_MACHINE_IP_ADDRESS_HERE>",
|
||||
"port": 1234
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
##### Configure the extension to enable remote debugging
|
||||
|
||||
Open the **~/.vscode/extensions/ms-vscode.cpptools-\<version\>/debugAdapters/OpenDebugAD7** file with a text editor and locate and uncomment the line at the bottom. When you start debugging, it will now hang until the remote debugger is attached from VS Code.
|
||||
|
||||
##### Attach the remote debugger
|
||||
|
||||
Select the `Attach to Mono` configuration and hit F5.
|
||||
|
||||
#### Additional Notes
|
||||
|
||||
Note: If you are debugging to CentOS, you will need to make an exception in the firewall.
|
||||
* `sudo firewall-cmd --zone=public --add-port=1234/tcp --permanent`
|
||||
* `sudo firewall-cmd --reload`
|
||||
|
||||
@@ -1,54 +1 @@
|
||||
# Pipe Transport
|
||||
|
||||
Pipe Transport allows communication through a pipe program to a remote shell. An example on Linux would be `ssh`.
|
||||
|
||||
## How-To
|
||||
|
||||
We have added `"pipeTransport"` as an option within the **launch.json** file. The structure looks as follows:
|
||||
```json
|
||||
"pipeTransport": {
|
||||
"pipeCwd": "/usr/bin",
|
||||
"pipeProgram": "/usr/bin/ssh",
|
||||
"pipeArgs": [
|
||||
"-pw",
|
||||
"<password>",
|
||||
"[email protected]"
|
||||
],
|
||||
"debuggerPath": "/usr/bin/gdb"
|
||||
},
|
||||
```
|
||||
The `pipeArgs` can be any set of arguments necessary to setup and authenticate the pipe connection. In the example, a password is used but you can also use an ssh key.
|
||||
|
||||
You may also need to add a `sourceFileMap` to map the path of where the code exists on the remote shell to where it is locally:
|
||||
```json
|
||||
"sourceFileMap": {
|
||||
// "remote": "local"
|
||||
"/home/user/src": "/src/projectA/src"
|
||||
}
|
||||
```
|
||||
|
||||
## Attach
|
||||
|
||||
You can also use the above `pipeTransport` block to attach to a remote process. In the attach case, you will need to specify a `processId`. We have added the ability to query processes from the remote machine. To do this, change `"processId": "${command.pickProcess}"` to `"processId": "${command.pickRemoteProcess}"`. The `pipeTransport` settings will be used to query the processes on the remote machine. Then select the process from the drop down list. As with `launch`, you may need to configure `sourceFileMap`.
|
||||
|
||||
## Docker example
|
||||
|
||||
The `pipeTransport` can also be used to debug a process in a Docker container. For an attach, **launch.json** will include:
|
||||
|
||||
```json
|
||||
"pipeTransport": {
|
||||
"pipeCwd": "${workspaceRoot}",
|
||||
"pipeProgram": "docker",
|
||||
"pipeArgs": [
|
||||
"exec",
|
||||
"-i",
|
||||
"hello_gdb",
|
||||
"sh",
|
||||
"-c"
|
||||
],
|
||||
"debuggerPath": "/usr/bin/gdb"
|
||||
},
|
||||
```
|
||||
Where `hello_gdb` is the name of your container.
|
||||
|
||||
Launching a process is accomplished by starting a container and then using the same `pipeTransport` launch additional processes in the container. See this [**launch.json**](https://github.com/andyneff/hello-world-gdb/blob/master/.vscode/launch.json) for a [full example](https://github.com/andyneff/hello-world-gdb/).
|
||||
The documentation for pipe transport has moved to https://code.visualstudio.com/docs/cpp/pipe-transport.
|
||||
@@ -1,91 +1 @@
|
||||
# Windows 10's Windows Subsystem for Linux
|
||||
|
||||
With the release of Windows 10 Creators Update (Build 15063), you will now be able to use Visual Studio Code and the Microsoft C/C++ extension to debug your [Windows Subsystem for Linux (WSL)](https://msdn.microsoft.com/en-us/commandline/wsl/about) projects.
|
||||
|
||||
Code can be written on Windows itself using VSCode and debugged through `bash.exe` to the Bash on Windows layer.
|
||||
|
||||
As of the Fall Creator's Update, you can have multiple distros installed, but `bash.exe` and `wsl.exe` use the default distro. Use [WSL Config](https://msdn.microsoft.com/en-us/commandline/wsl/wsl-config) to set your default distro.
|
||||
|
||||
**NOTE: Creator's Update (Build 15063 or later) is required due to bug-fixes within the subsystem that we rely on to provide debugging. Debugging using a previous version of WSL is unsupported and likely will not work. To check your Windows version, enter `winver` in a command prompt.**
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* [Windows 10 Creators Update or later with Windows Subsystem for Linux](https://msdn.microsoft.com/en-us/commandline/wsl/install_guide) installed.
|
||||
* Install g++/gcc and gdb within `WSL` to allow compiling and debugging. You can use the package manager to do this. For example, to install g++, you can run `sudo apt install g++` in the Bash window.
|
||||
* [Visual Studio Code](https://code.visualstudio.com) + Microsoft C/C++ extension for VSCode.
|
||||
|
||||
## How-To
|
||||
|
||||
To debug, commands will be routed from Windows through `bash.exe` to set up debugging. Because our extension runs as a 32-bit process, it will need to use the `C:\Windows\SysNative` folder to access the `bash.exe` executable that is normally in `C:\Windows\System32`. We will be using the `"pipeTransport"` ability within the extension to do debugging and `"sourceFileMap"` to map the source from the subsystem's paths back to Windows path.
|
||||
|
||||
**NOTE: Applications will need to be compiled in the `Windows Subsystem for Linux (WSL)` prior to debugging.**
|
||||
|
||||
### Example `launch.json` for Launching
|
||||
|
||||
In the following example, I have a local drive, `Z:\` that has my source code within windows for an app called _kitchensink_. I have set up the `"program"` and `"cwd"` paths to point to the directory within `WSL`. I have set up the `"pipeTransport"` to use `bash.exe`. I have also set up a `"sourceFileMap"` to have everything that is returned by `gdb` that starts with `/mnt/z` to point to `Z:\\` in Windows.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "C++ Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "/mnt/z/Bash/kitchensink/a.out",
|
||||
"args": ["-fThreading"],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "/mnt/z/Bash/kitchensink",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"windows": {
|
||||
"MIMode": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"pipeTransport": {
|
||||
"pipeCwd": "",
|
||||
"pipeProgram": "c:\\windows\\sysnative\\bash.exe",
|
||||
"pipeArgs": ["-c"],
|
||||
"debuggerPath": "/usr/bin/gdb"
|
||||
},
|
||||
"sourceFileMap": {
|
||||
"/mnt/z": "z:\\"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Example `launch.json` for Attaching to an Existing Process
|
||||
|
||||
This configuration similar to the launch process above. I have chosen to start the same application above from the Bash command line and now I want to attach to it for debugging. I have changed the `"processID"` to use the remote process picker by specifying the command `"${command:pickRemoteProcess}"` and set up the same `"sourceFileMap"`. When I press <kbd>F5</kbd> to attach, I get a picker drop down showing the running processes within `WSL`. I can scroll or search for the process I want to attach to and start debugging.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "C++ Attach",
|
||||
"type": "cppdbg",
|
||||
"request": "attach",
|
||||
"program": "/mnt/z/Bash/kitchensink/a.out",
|
||||
"processId": "${command:pickRemoteProcess}",
|
||||
"windows": {
|
||||
"MIMode": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"pipeTransport": {
|
||||
"pipeCwd": "",
|
||||
"pipeProgram": "c:\\windows\\sysnative\\bash.exe",
|
||||
"pipeArgs": ["-c"],
|
||||
"debuggerPath": "/usr/bin/gdb"
|
||||
},
|
||||
"sourceFileMap": {
|
||||
"/mnt/z": "z:\\"
|
||||
}
|
||||
}
|
||||
```
|
||||
The documentation for GCC on Windows Subsystem for Linux (WSL) has moved to https://code.visualstudio.com/docs/cpp/config-wsl.
|
||||
@@ -1,15 +1 @@
|
||||
# Natvis - Custom views for native objects
|
||||
|
||||
The Natvis framework allows developers to write custom schemas to help visualize native objects.
|
||||
|
||||
For gdb/lldb debugging (`"type": "cppdbg"`), a subset of the Natvis framework has been ported to the C/C++ extension and the code resides in the [MIEngine](https://github.com/Microsoft/MIEngine) shared component. If additional features that are not implemented are requested, please file an [issue](https://github.com/Microsoft/MIEngine/issues) on the MIEngine GitHub page with details of what is missing.
|
||||
|
||||
For Visual C++ debugging (`"type": "cppvsdbg"`), the debugger contains the full implementation of the Natvis framework as Visual Studio.
|
||||
|
||||
## Documentation
|
||||
|
||||
The official documentation can be found [here](https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects).
|
||||
|
||||
## Schema
|
||||
|
||||
The Natvis schema can be found [here](natvis.xsd).
|
||||
The documentation for Natvis has moved to https://code.visualstudio.com/docs/cpp/natvis.
|
||||
+1
-45
@@ -1,45 +1 @@
|
||||
# FAQs
|
||||
|
||||
## Table of Contents
|
||||
* Setup: [Debugging Setup](#debugging-setup)
|
||||
* Debugger: [Why is debugging not working?](#why-is-debugging-not-working)
|
||||
* Build: [How to enable debug symbols?](#how-to-enable-debug-symbols)
|
||||
|
||||
## Debugging Setup
|
||||
The debugger needs to be configured to know which executable and debugger to use:
|
||||
|
||||
Click menu item: `Debug` -> `Add Configuration...`
|
||||
|
||||
The file **launch.json** will now be open for editing with a new configuration. The default settings will *probably* work except that you need to specify the **program** setting.
|
||||
|
||||
See the [**Documentation/Debugger**](https://github.com/Microsoft/vscode-cpptools/tree/master/Documentation/Debugger) folder in this repository for more in-depth documentation on how to configure the debugger.
|
||||
|
||||
## Why is debugging not working?
|
||||
|
||||
### My breakpoints aren't being hit
|
||||
|
||||
When you start debugging, if it is showing that your breakpoints aren't bound (solid red circle) or they are not being hit, you may need to enable [debug symbols](#how-to-enable-debug-symbols) during compilation.
|
||||
|
||||
### Debugging starts but all the lines in my stack trace are grey
|
||||
|
||||
If your debugger is showing a grey stacktrace or won't stop at a breakpoint,or the symbols in the call stack are grey then your executable was compiled without [debug symbols](#how-to-enable-debug-symbols).
|
||||
|
||||
## How to enable debug symbols?
|
||||
|
||||
Enabling debug symbols are dependent on the type of compiler you are using. Below are some of the compilers and the compiler options necessary to enable debug symbols.
|
||||
|
||||
When in doubt, please check your compiler's documentation for the options necessary to include debug symbols in the output. This may be some variant of `-g` or `--debug`.
|
||||
|
||||
* #### Clang (C++)
|
||||
* If you invoke the compiler manually then add the `--debug` option.
|
||||
* If you're using a script then make sure the `CXXFLAGS` environment variable is set; e.g. `export CXXFLAGS="${CXXFLAGS} --debug"`
|
||||
* If you're using CMake then set make sure the `CMAKE_CXX_FLAGS` is set; e.g. `export CMAKE_CXX_FLAGS=${CXXFLAGS}`
|
||||
|
||||
* #### Clang (C)
|
||||
See Clang C++ but use `CFLAGS` instead of `CXXFLAGS`.
|
||||
|
||||
* #### gcc or g++
|
||||
If you invoke the compiler manually, add the `-g` option.
|
||||
|
||||
* #### cl.exe
|
||||
Symbols are located in the `*.pdb` file.
|
||||
The FAQs for the C/C++ extension has moved to https://code.visualstudio.com/docs/cpp/faq-cpp.
|
||||
@@ -1,56 +1,3 @@
|
||||
This file is deprecated.
|
||||
|
||||
# Configuring includePath for better IntelliSense results
|
||||
|
||||
This page describes how to configure include paths for folders containing C or C++ files to get the full IntelliSense experience. If you're seeing the following message when opening a folder in VS Code, it means the C++ IntelliSense engine needs additional information about the paths in which your include files are located.
|
||||
|
||||

|
||||
|
||||
## Where are the include paths defined?
|
||||
|
||||
The include paths are defined in the `"includePath"` setting in a file called **c_cpp_properties.json** located in the **.vscode** directory in the opened folder.
|
||||
|
||||
You can create or open this file by either using the `"C/Cpp: Edit Configurations"` command in the command palette or by selecting `"Edit "includePath" setting"` in the lightbulb menu (see the screenshot below). The quickest way to locate a lightbulb is to scroll to the top of the source file and click on any green squiggle that shows up under a #include statement.
|
||||
|
||||

|
||||
|
||||
When a folder is opened, the extension attempts to locate your system headers based on your operating system, but it does not know about any other libraries that your project depends on. You can hover over the green squiggles or open the Problems window to understand which headers the IntelliSense engine is unable to open - sometimes it's the dependent headers that can't be located.
|
||||
|
||||

|
||||
|
||||
## How to specify the include paths?
|
||||
|
||||
You can specify the remaining paths using one of the techniques described below.
|
||||
|
||||
#### 1. Use `compile_commands.json` file to supply includePaths and defines information
|
||||
|
||||
The extension can get the information for `"includePath"` and `"defines"` from a **compile_commands.json** file, which can be auto-generated by many build systems such as CMake and Ninja. Look for the section where your current configuration is defined (by default there's one configuration per OS, such as "Win32 or "Mac"), and set the `"compileCommands"` property in **c_cpp_properties.json** to the full path to your **compile_commands.json** file and the extension will use that instead of the `"includes"` and `"defines"` properties for IntelliSense.
|
||||
|
||||

|
||||
|
||||
#### 2. Use the lightbulb suggestions to auto-resolve includePath
|
||||
|
||||
The first thing to try is to leverage the lightbulb path suggestions to auto-resolve the include paths. When you open a folder, the extension will **recursively** search for potential include paths that match the header files your code is using based on the paths set by the `"browse.path"` setting in **c_cpp_properties.json**. Click on the green squiggles under #include statements and you'll see a lightbulb offering suggestions of paths that will allow IntelliSense to resolve the included file.
|
||||
|
||||

|
||||
|
||||
If you don't see path suggestions in the lightbulb, try adding the root folder where the headers are likely located in to the `"browse.path"` setting in **c_cpp_properties.json**. This allows the extension to **recursively** search in these folders and offer more suggestions in the lightbulb as the search process goes on.
|
||||
|
||||
#### 3. Manually add include paths
|
||||
If none of the above fully resolves the paths, you could manually specify the paths to the headers that your project depends on in the **c_cpp_properties.json** file. Look for the section where your current configuration is defined (by default there's one configuration per OS, such as "Win32 or "Mac"), and add your paths in the `"includePath"` setting and defines in the `"defines"` setting. For example, the following screenshot shows a snippet of the file specifying path for the Mac configuration.
|
||||
|
||||

|
||||
|
||||
## Verify the include paths are correctly resolved
|
||||
|
||||
There are two ways to verify that the include paths are correctly resolved:
|
||||
|
||||
1. The green squiggles in the source file are no longer showing
|
||||
2. Error messages are cleared in the Problems window
|
||||
|
||||
This indicates that the IntelliSense engine has got the include paths resolved so you can start enjoying the full IntelliSense for your C or C++ code for the current translation unit. Note that you may still see errors on other files if they belong to a different translation unit that requires additional include paths to be configured.
|
||||
|
||||
## See Also
|
||||
|
||||
[IntelliSense engines](https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/IntelliSense%20engine.md)
|
||||
|
||||
[**c_cpp_properties.json** reference guide](https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/c_cpp_properties.json.md)
|
||||
Please find documentation for the C/C++ extension at https://code.visualstudio.com/docs/languages/cpp.
|
||||
@@ -1,99 +1 @@
|
||||
# Customizing Default Settings
|
||||
|
||||
In version 0.17.0 we introduced new settings that allow you to override the extension's default values for properties set in **c_cpp_properties.json**.
|
||||
|
||||
## New VS Code settings
|
||||
|
||||
The following `C_Cpp.default.*` settings map to each of the properties in a configuration block of **c_cpp_properties.json**. Namely:
|
||||
|
||||
```
|
||||
C_Cpp.default.includePath : string[]
|
||||
C_Cpp.default.defines : string[]
|
||||
C_Cpp.default.compileCommands : string
|
||||
C_Cpp.default.macFrameworkPath : string[]
|
||||
C_Cpp.default.forcedIncludes : string[]
|
||||
C_Cpp.default.intelliSenseMode : string
|
||||
C_Cpp.default.compilerPath : string
|
||||
C_Cpp.default.cStandard : c89 | c99 | c11
|
||||
C_Cpp.default.cppStandard : c++98 | c++03 | c++11 | c++14 | c++17
|
||||
C_Cpp.default.browse.path : string[]
|
||||
C_Cpp.default.browse.databaseFilename : string
|
||||
C_Cpp.default.browse.limitSymbolsToIncludedHeaders : boolean
|
||||
```
|
||||
|
||||
These settings have all of the benefits of VS Code settings, meaning that they can have default, "User", "Workspace", and "Folder" values. So you can set a global value for `C_Cpp.default.cppStandard` in your "User" settings and have it apply to all of the folders you open. If any one folder needs a different value, you can override the value by adding a "Folder" or "Workspace" value.
|
||||
|
||||
This property of VS Code settings allows you to configure each of your workspaces independently - making the **c_cpp_properties.json** file optional.
|
||||
|
||||
## Updated **c_cpp_properties.json** syntax
|
||||
|
||||
A special variable has been added to the accepted syntax of **c_cpp_properties.json** that will instruct the extension to insert the value from the VS Code settings mentioned above. If you set the value of any setting in **c_cpp_properties.json** to "${default}" it will instruct the extension to read the VS Code default setting for that property and insert it. For example:
|
||||
|
||||
```
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Win32",
|
||||
"includePath": [
|
||||
"additional/paths",
|
||||
"${default}"
|
||||
],
|
||||
"defines": [
|
||||
"${default}",
|
||||
],
|
||||
"macFrameworkPath": [
|
||||
"${default}",
|
||||
"additional/paths"
|
||||
],
|
||||
"forceInclude": [
|
||||
"${default}",
|
||||
"additional/paths"
|
||||
],
|
||||
"compileCommands": "${default}",
|
||||
"browse": {
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": "${default}",
|
||||
"path": [
|
||||
"${default}",
|
||||
"additional/paths"
|
||||
]
|
||||
},
|
||||
"intelliSenseMode": "${default}",
|
||||
"cStandard": "${default}",
|
||||
"cppStandard": "${default}",
|
||||
"compilerPath": "${default}"
|
||||
}
|
||||
],
|
||||
```
|
||||
|
||||
Take note that for the properties that accept string[], the syntax proposed above allows you to augment the VS Code setting with additional values, thus allowing you to have common paths listed in the VS Code settings and configuration-specific settings in **c_cpp_properties.json**.
|
||||
|
||||
If a property is missing from **c_cpp_properties.json**, the extension will use the value in the VS Code setting. If a developer assigns values to all of the settings that apply for a given folder, then **c_cpp_properties.json** could be removed from the .vscode folder as it will no longer be needed.
|
||||
|
||||
### System includes
|
||||
|
||||
A new setting will be added that allows you specify the system include path separate from the folder's include path. If this setting has a value, then the system include path the extension gets from the compiler specified in the `compilerPath` setting will not be added to the path array that the extension uses for IntelliSense. We may want to provide a VS Code command to populate this value from the compiler's default for users who are interested in using it in case they want to make some modifications to the defaults.
|
||||
|
||||
```
|
||||
C_Cpp.default.systemIncludePath : string[]
|
||||
```
|
||||
|
||||
### System Include Path/Defines Resolution Strategies
|
||||
|
||||
The extension determines the system includePath and defines to send to the IntelliSense engine in the following manner:
|
||||
|
||||
1. If `compileCommands` has a valid value and the file open in the editor is in the database, use the compile command in the database entry to determine the include path and defines.
|
||||
* The system include path and defines are determined using the following logic (in order):
|
||||
1. If `systemIncludePath` has a value, use it (continue to the next step to search for system defines).
|
||||
2. If `compilerPath` is valid, query it.
|
||||
3. Interpret the first argument in the command as the compiler and attempt to query it.
|
||||
4. If `compilerPath` is `""`, use an empty array for system include path and defines.
|
||||
5. If `compilerPath` is undefined, look for a compiler on the system and query it.
|
||||
|
||||
2. If `compileCommands` is invalid or the current file is not listed in the database, use the `includePath` and `defines` properties in the configuration for IntelliSense.
|
||||
* The system include path and defines are determined using the following logic (in order):
|
||||
1. If `systemIncludePath` has a value, use it (continue to the next step to search for system defines).
|
||||
2. If `compilerPath` is valid, query it.
|
||||
3. If `compilerPath` is `""`, use an empty array for system include path and defines (they are assumed to be in the `includePath` and `defines` for the current config already).
|
||||
4. If `compilerPath` is undefined, look for a compiler on the system and query it.
|
||||
|
||||
System includes should no longer be added to the `"includePath"` or `"browse.path"` variables. If the extension detects any system include paths in the `"includePath"` property it will silently remove them so that it can ensure system include paths are added last and in the correct order (this is especially important for GCC/Clang). In a future update we may add a notification message to the extension to remind developers to remove system include paths from their `"includePath"` and `'browse.path"` as they will be ignored.
|
||||
The documentation for customizing default settings has moved to https://code.visualstudio.com/docs/cpp/customize-default-settings-cpp.
|
||||
@@ -1,12 +1 @@
|
||||
# How to enable logging in the extension
|
||||
|
||||
If you are experiencing a problem that we are unable to diagnose based on information in your issue report, we might ask you to enable logging and send us your logs.
|
||||
|
||||
As of version 0.14.0 of the extension, logging information is now delivered directly to the Output window in VSCode. To turn on full logging for an issue report, add `"C_Cpp.loggingLevel": "Information"` to your **settings.json**.
|
||||
|
||||

|
||||
|
||||
VS Code organizes the logging from different extensions to improve readability so you must select the "C/C++" option in the log filter selector to see logging from the C/C++ extension:
|
||||
|
||||

|
||||
|
||||
The documentation for logging has moved to https://code.visualstudio.com/docs/cpp/enable-logging-cpp.
|
||||
@@ -1,66 +1 @@
|
||||
# Frequently asked questions
|
||||
|
||||
* [How do I get IntelliSense to work correctly?](#how-do-i-get-intellisense-to-work-correctly)
|
||||
* [Why do I see red squiggles under Standard Library types?](#why-do-i-see-red-squiggles-under-standard-library-types)
|
||||
* [How do I get the new IntelliSense to work with MinGW on Windows?](#how-do-i-get-the-new-intellisense-to-work-with-mingw-on-windows)
|
||||
* [How do I get the new IntelliSense to work with the Windows Subsystem for Linux?](#how-do-i-get-the-new-intellisense-to-work-with-the-windows-subsystem-for-linux)
|
||||
* [What is the difference between `"includePath"` and `"browse.path"` in **c_cpp_properties.json**?](#what-is-the-difference-between-includepath-and-browsepath-in-c_cpp_propertiesjson)
|
||||
* [How do I re-create the IntelliSense database?](#how-do-i-re-create-the-intellisense-database)
|
||||
|
||||
## How do I get IntelliSense to work correctly?
|
||||
|
||||
There are two IntelliSense engines present in the extension: the "fuzzy" engine (or Tag Parser), and the new "Default" engine. If you are using version 0.11.0 or higher of the cpptools extension, then you can preview our new IntelliSense engine which has more accurate auto-complete suggestions and tooltips. To use the new engine, you need to ensure that `"C_Cpp.intelliSenseEngine"` is set to `"Default"` in your settings. Since the engine is still in preview it is not on by default for everyone yet.
|
||||
|
||||
After selecting the IntelliSense engine that you prefer, take a look at the Problems window in VS Code to see if you need to do any further configuration for your folder. For example, the Default engine will not provide squiggles and auto-complete suggestions for a translation unit (read: a source file and its dependencies) if the include path is not configured properly. You can select any of the problems in the window to navigate to the line when the problem was detected and a lightbulb will appear in the editor with some options (code actions) to help you resolve the problem:
|
||||
|
||||
1. Update your `includePath` (and preprocessor defines)
|
||||
2. Force semantic IntelliSense
|
||||
|
||||
#### Update your `includePath` (and preprocessor defines)
|
||||
|
||||
Selecting this option will open a file called **c_cpp_properties.json**. If you haven't created this file already, it will be created for you in the **.vscode** folder of your workspace.
|
||||
|
||||
Add the necessary paths to your include files to the `"includePath"` array. The `${workspaceRoot}` variable is available to use to get a relative path to the folder you have opened. Also add any required symbols that need to be defined to the `"defines"` array. Both "\<var\>" and "\<var\>=\<value\>" syntax is accepted. When you edit and save this file, the IntelliSense engine will reset and reparse source your source files and headers with the new settings.
|
||||
|
||||
#### Force semantic IntelliSense
|
||||
|
||||
If you want IntelliSense to operate on your files even when all #include directives do not resolve, then you can choose the `Force semantic IntelliSense` code action to always use the new IntelliSense engine. You can also set the `C_Cpp.intelliSenseEngineFallback` setting to `"Disabled"`.
|
||||
|
||||
## Why do I see red squiggles under Standard Library types?
|
||||
|
||||
The most common reason for this is missing include paths and defines. The easiest way to fix this on each platform is as follows:
|
||||
|
||||
**Linux/Mac**
|
||||
* Set `"intelliSenseMode": "clang-x64"` and `"compilerPath"` in **c_cpp_properties.json** to the path to your compiler.
|
||||
|
||||
**Windows**
|
||||
* If you are using a Microsoft compiler from Visual Studio, set `"intelliSenseMode": "msvc-x64"`, but don't add the `"compilerPath"` property to **c_cpp_properties.json**.
|
||||
* If you are using Clang for Windows, set `"intelliSenseMode": "msvc-x64"`, and `"compilerPath"` in **c_cpp_properties.json** to the path to your compiler.
|
||||
|
||||
## How do I get the new IntelliSense to work with MinGW on Windows?
|
||||
|
||||
The page discussing configuration with MinGW is [here](https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/MinGW.md).
|
||||
|
||||
## How do I get the new IntelliSense to work with the Windows Subsystem for Linux?
|
||||
|
||||
The page discussing configuration with WSL is [here](https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/Windows%20Subsystem%20for%20Linux.md).
|
||||
|
||||
## What is the difference between `"includePath"` and `"browse.path"` in **c_cpp_properties.json**?
|
||||
|
||||
Starting with version 0.11.0 of the cpptools extension, there are now two settings in the **c_cpp_properties.json** file. They are used by the different IntelliSense engines that we support and have slightly different meanings for the components that use them.
|
||||
|
||||
The active IntelliSense engine is controlled via the `"C_Cpp.intelliSenseEngine"` setting in your **settings.json** file. The valid values for this setting are `"Default"` and `"Tag Parser"`.
|
||||
|
||||
* #### `"includePath"`
|
||||
This array of path strings is used by the new "Default" IntelliSense engine that was introduced in version 0.11.0 of the extension. This new engine provides semantic-aware IntelliSense features and will be the eventual replacement for the Tag Parser that has been powering the extension since it was first released. It currently provides tooltips and error squiggles in the editor. The remaining features (e.g. code completion, signature help, go to definition, ...) are implemented using the Tag Parser's database, so it is still important to ensure that the browse.path setting is properly set.
|
||||
|
||||
The paths that you specify for this setting are the same paths that you would send to your compiler via the `-I` switch. When your source files are parsed, the IntelliSense engine will prepend these paths to the files specified by your #include directives while attempting to resolve them. These paths are **not** searched recursively.
|
||||
|
||||
* #### `"browse.path"`
|
||||
This array of path strings is used by the "Tag Parser" (a.k.a. "browse engine"). This engine will _recursively_ enumerate all files under the paths specified and track them as potential includes while tag parsing your project folder. To disable recursive enumeration of a path, you can append a `/*` to the path string.
|
||||
|
||||
When you open a workspace for the first time, the extension adds `${workspaceRoot}` to both arrays. If this is undesirable, you can open your **c_cpp_properties.json** file and remove it.
|
||||
|
||||
## How do I re-create the IntelliSense database?
|
||||
|
||||
Starting in version 0.12.3 of the extension, we added a command that will reset your IntelliSense database. Open the command palette and choose the "C/Cpp: Reset IntelliSense Database" command.
|
||||
The FAQs for the C/C++ extension has moved to https://code.visualstudio.com/docs/cpp/faq-cpp.
|
||||
@@ -1,44 +0,0 @@
|
||||
# IntelliSense engines
|
||||
|
||||
There are two IntelliSense engines used to power the C/C++ IntelliSense experience in VS Code.
|
||||
|
||||
* `"Default"` - Visual Studio's IntelliSense engine, which is the default engine that provides semantic-aware IntelliSense features
|
||||
* `"Tag Parser"` - the "fuzzy" IntelliSense engine that provides quick but "fuzzy" results, is used to provide the fallback experience if the default engine is unable to fully resolve include paths
|
||||
|
||||
Ultimately all the IntelliSense and code browsing features will be powered by the "Default" engine. The following features have been implemented so far:
|
||||
|
||||
* Auto-complete suggestions for class/struct/namespace members
|
||||
* Parameter hints
|
||||
* Quick info (hover over tooltip)
|
||||
* Error squiggles
|
||||
* Reference highlighting
|
||||
|
||||
The other IntelliSense features, such as global auto-complete, and code browsing features, such as Go to definition/declaration, are currently powered by the "Tag Parser" based engine.
|
||||
|
||||
### `includePath` and `browse.path`
|
||||
The two IntelliSense engines use two different settings in the **c_cpp_properties.json** file for specifying include paths. This file is located in the **.vscode** directory in the opened folder. You can create or open this file by either using the "C/Cpp: Edit Configurations" command in the command palette or by selecting "Edit "includePath" setting" in the lightbulb menu. Look for the following settings in the section where your current configuration is defined (by default there's one configuration per OS, such as "Win32 or "Mac").
|
||||
|
||||
* #### `"includePath"`
|
||||
This array of path strings is used by the "Default" IntelliSense engine. The paths that you specify for this setting are the same paths that you would send to your compiler via the -I switch. When your source files are parsed, the IntelliSense engine will prepend these paths to the files specified by your #include directives while attempting to resolve them. These paths are searched **non-recursively**.
|
||||
|
||||
* #### `"browse.path"`
|
||||
This array of path strings is used by the "Tag Parser" (a.k.a. "browse engine"). This engine will **recursively** enumerate all files under the paths specified and track them as potential includes while tag parsing your project folder. To disable recursive enumeration of a path, you can append a `/*` to the path string.
|
||||
|
||||
### How fallback works and how to control the behavior
|
||||
|
||||
The extension first tries to fully parse any opened file using the "Default" IntelliSense engine. If it discovers that it cannot find a header file or a dependency, it will fall back to the tag parser and provide the fuzzy IntelliSense behavior. The fallback affects a full translation unit (TU), not just a single open file. The Problems panel provides details about unresolved headers and dependencies. Other opened TUs will continue to use the "Default" IntelliSense engine provided that all #include dependencies are resolved.
|
||||
|
||||
We recognize that resolving all #includes may not be necessary for all projects and you may still want to experience the productivity benefits of using the "Default" semantic engine without customizing the default include path. For that, the “Force semantic IntelliSense” action can be chosen. When invoked, all unresolved #include squiggles will turn red and semantic member list and linting will be enabled in all files regardless of whether or not #include statements can be resolved.
|
||||
|
||||
### IntelliSense engine setting
|
||||
|
||||
We recommend using the "Default" engine for the best IntelliSense experience. However, it is possible to explicitly choose the IntelliSense engine by editing your [user or workspace settings](https://code.visualstudio.com/docs/getstarted/settings). The setting you should modify is `"C_Cpp.intelliSenseEngine"`. There are two values for this setting:
|
||||
|
||||
* `"Default"` - use Visual Studio's IntelliSense engine
|
||||
* `"Tag Parser"` - use the "fuzzy" IntelliSense engine
|
||||
|
||||
### See Also
|
||||
|
||||
[Configuring includePath for better IntelliSense results](https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/Getting%20started%20with%20IntelliSense%20configuration.md)
|
||||
|
||||
[**c_cpp_properties.json** reference guide](https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/c_cpp_properties.json.md)
|
||||
@@ -1,32 +1,2 @@
|
||||
# MinGW
|
||||
|
||||
To use MinGW on Windows, we recommend you add the following configuration to your **c_cpp_properties.json** file. Select "C/Cpp: Edit Configurations" from the command palette to create this file if you haven't already.
|
||||
|
||||
## Extension version 0.17.0 and higher:
|
||||
|
||||
When you set the `compilerPath` property and change `intelliSenseMode` to `clang-x64`, you no longer need to copy the system include path or defines to `includePath`, `browse.path`, or `defines` to enable IntelliSense to work properly. For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "MinGW",
|
||||
"intelliSenseMode": "clang-x64",
|
||||
"compilerPath": "C:/mingw64/bin/gcc.exe",
|
||||
"includePath": [
|
||||
"${workspaceFolder}"
|
||||
],
|
||||
"defines": [],
|
||||
"browse": {
|
||||
"path": [
|
||||
"${workspaceFolder}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
},
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++17"
|
||||
}
|
||||
```
|
||||
|
||||
## Extension version 0.16.1 and earlier:
|
||||
|
||||
If you have an older version of the C/C++ extension installed, use [these instructions](Archive/MinGW.md) instead.
|
||||
The documentation for Mingw-w64 has moved to https://code.visualstudio.com/docs/cpp/config-mingw.
|
||||
@@ -1,43 +1 @@
|
||||
# Windows Subsystem for Linux
|
||||
|
||||
> **Note:** If you are on **build 17110 of Windows or higher**, you must use version 0.17.0 or higher for IntelliSense to work. The Windows team turned on case-sensitive folders for the WSL environment and the C/C++ extension doesn't support case-sensitive folders until version 0.17.0.
|
||||
|
||||
To use the Windows Subsystem for Linux with this extension you need to add a configuration to your **c_cpp_properties.json** file which adds the necessary header paths from within the WSL filesystem to the `includePath`.
|
||||
|
||||
Select "C/Cpp: Edit Configurations" from the command palette to create the **c_cpp_properties.json** file if you haven't already.
|
||||
|
||||
## With extension version 0.17.0 and higher:
|
||||
|
||||
In **c_cpp_properties.json** you can directly address your WSL compiler and include paths by using *nix-style paths and we will do the conversion to Windows paths for you. If you have multiple distros installed, we disambiguate the `compilerPath` by picking the one marked as Default when you run `wslconfig.exe /l` in a CMD or PowerShell window. We continue to support Windows-style paths for these properties as outlined in the [archived instructions](Archive/Windows%20Subsystem%20for%20Linux.md) if you prefer to use those.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "WSL",
|
||||
"intelliSenseMode": "clang-x64",
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"includePath": [
|
||||
"${workspaceFolder}",
|
||||
"/mnt/c/libraries/lib1/include",
|
||||
"C:/libraries/lib2/include"
|
||||
],
|
||||
"defines": [],
|
||||
"browse": {
|
||||
"path": [
|
||||
"${workspaceFolder}",
|
||||
"/mnt/c/libraries"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
},
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++17"
|
||||
}
|
||||
```
|
||||
|
||||
## Earlier versions of the extension:
|
||||
|
||||
If you are on a build of Windows prior to 17110 and you have an older version of the C/C++ extension installed, use [these instructions](Archive/Windows%20Subsystem%20for%20Linux.md) instead.
|
||||
|
||||
---
|
||||
|
||||
Remember to [heed the warnings of the Windows team about not creating or editing Linux files from a Windows app](https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/)!
|
||||
The documentation for GCC on Windows Subsystem for Linux (WSL) has moved to https://code.visualstudio.com/docs/cpp/config-wsl.
|
||||
@@ -1,96 +1 @@
|
||||
# `c_cpp_properties.json` Reference Guide
|
||||
|
||||
> See also: [Customizing Default Settings](Customizing%20Default%20Settings.md)
|
||||
|
||||
### Example
|
||||
|
||||
```json
|
||||
{
|
||||
"env" : {
|
||||
"myDefaultIncludePath": [
|
||||
"${workspaceFolder}",
|
||||
"${workspaceFolder}/include"
|
||||
],
|
||||
"myCompilerPath": "/usr/local/bin/gcc-7"
|
||||
},
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Mac",
|
||||
"intelliSenseMode": "clang-x64",
|
||||
"includePath": [ "${myDefaultIncludePath}", "/another/path" ],
|
||||
"macFrameworkPath": [ "/System/Library/Frameworks" ],
|
||||
"defines": [ "FOO", "BAR=100" ],
|
||||
"forcedInclude": [ "${workspaceFolder}/include/config.h" ],
|
||||
"compilerPath": "/usr/bin/clang",
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++17",
|
||||
"compileCommands": "/path/to/compile_commands.json",
|
||||
"browse": {
|
||||
"path": [ "${workspaceFolder}" ],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
```
|
||||
|
||||
## Top-level properties
|
||||
|
||||
* #### `env`
|
||||
An array of user-defined variables that will be available for substitution in the configurations via the standard environment variable syntax: `${<var>}` or `${env:<var>}`. Strings and arrays of strings are accepted.
|
||||
|
||||
* #### `configurations`
|
||||
An array of configuration objects that provide the IntelliSense engine with information about your project and your preferences. By default, the extension creates a configuration for you based on your operating system. You may also add additional configurations.
|
||||
|
||||
* #### `version`
|
||||
We recommend you don't edit this field. It tracks the current version of the **c_cpp_properties.json** file so that the extension knows what properties and settings should be present and how to upgrade this file to the latest version.
|
||||
|
||||
## Configuration properties
|
||||
|
||||
* #### `name`
|
||||
A friendly name for the configuration. "Linux", "Mac", and "Win32" are special names that instruct the extension to load that configuration by default on the associated operating system unless additional configurations have been created. The status bar in VS Code will show you which configuration is active. You can also click on the label in the status bar to change the active configuration.
|
||||
|
||||
* #### `intelliSenseMode`
|
||||
If `"C_Cpp.intelliSenseEngine"` is set to "Default" in your settings file, this property determines which mode the IntelliSense engine will run in. `"msvc-x64"` maps to Visual Studio mode with 64-bit pointer sizes. `"clang-x64"` maps to GCC/CLang mode with 64-bit pointer sizes. Windows uses `"msvc-x64"` by default and Linux/Mac use `"clang-x64"` by default.
|
||||
|
||||
* #### `includePath`
|
||||
If `"C_Cpp.intelliSenseEngine"` is set to "Default" in your settings file, this list of paths will be used by IntelliSense to search for headers included by your source files. This is basically the same as the list of paths you pass to your compiler with the `-I` switch. If a path ends with `/**` the IntelliSense engine will do a recursive search for includes starting from that directory. If on Windows with Visual Studio installed, or if a compiler is specified in the `compilerPath` setting, it is not necessary to list the system include paths in this list.
|
||||
|
||||
* #### `macFrameworkPath`
|
||||
If `"C_Cpp.intelliSenseEngine"` is set to "Default" in your settings file, this list of paths will be used by IntelliSense to search for framework headers included by your source files. This is basically the same as the list of paths you pass to your compiler with the `-F` switch; the IntelliSense engine will not do a recursive search in these paths for includes.
|
||||
|
||||
* #### `defines`
|
||||
If `"C_Cpp.intelliSenseEngine"` is set to "Default" in your settings file, this list of preprocessor symbols will be used by IntelliSense during the compilation of your source files. This is basically the same as the list of symbols you pass to your compiler with the `-D` switch. If on Windows with Visual Studio installed, or if a compiler is specified in the `compilerPath` setting, it is not necessary to list the system include paths in this list.
|
||||
|
||||
* #### `forcedInclude` (optional)
|
||||
A list of files that should be included before any other characters in the source file are processed. Files are included in the order listed.
|
||||
|
||||
* #### `compilerPath` (optional)
|
||||
The absolute path to the compiler you use to build your project. The extension will query the compiler to determine the system include paths and default defines to use for IntelliSense. Args can be added to modify the includes/defines used, e.g. `-nostdinc++`, `-m32`, etc., but paths with spaces must be surrounded by double quotes (`"`) if args are used.
|
||||
|
||||
* #### `cStandard`
|
||||
The C standard revision to use for IntelliSense in your project.
|
||||
|
||||
* #### `cppStandard`
|
||||
The C++ standard revision to use for IntelliSense in your project.
|
||||
|
||||
* #### `compileCommands` (optional)
|
||||
If `"C_Cpp.intelliSenseEngine"` is set to "Default" in your settings file, the includes and defines discovered in this file will be used instead of the values set for `includePath` and `defines`. If the compile commands database does not contain an entry for the translation unit that corresponds to the file you opened in the editor, then a warning message will appear and the extension will use the `includePath` and `defines` settings instead.
|
||||
|
||||
>For more information about the file format, see the [Clang documentation](https://clang.llvm.org/docs/JSONCompilationDatabase.html). Some build systems, such as CMake, [simplify generating this file](https://cmake.org/cmake/help/v3.5/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html).
|
||||
|
||||
* #### `browse`
|
||||
The set of properties used when `"C_Cpp.intelliSenseEngine"` is set to `"Tag Parser"` (also referred to as "fuzzy" IntelliSense, or the "browse" engine). These properties are also used by the Go To Definition/Declaration features, or when the "Default" IntelliSense engine is unable to resolve the #includes in your source files.
|
||||
|
||||
### Browse properties
|
||||
|
||||
* #### `path`
|
||||
This list of paths will be used by the Tag Parser to search for headers included by your source files. The Tag Parser will automatically search all subfolders in these paths unless the path ends with a `/*` or `\*`. For example, `/usr/include` directs the Tag Parser to search the `include` folder and its subfolders for headers while `/usr/include/*` directs the Tag Parser not to look in any subfolders of `/usr/include`.
|
||||
|
||||
* #### `limitSymbolsToIncludedHeaders`
|
||||
When true, the Tag Parser will only parse code files that have been directly or indirectly included by a source file in `${workspaceFolder}`. When false, the Tag Parser will parse all code files found in the paths specified in the **path** list.
|
||||
|
||||
* #### `databaseFilename`
|
||||
When set, this instructs the extension to save the Tag Parser's symbol database somewhere other than the workspace's default storage location. If a relative path is specified, it will be made relative to the workspace's default storage location, not the workspace folder itself. The `${workspaceFolder}` variable can be used to specify a path relative to the workspace folder (e.g. `${workspaceFolder}/.vscode/browse.vc.db`)
|
||||
The documentation for c_cpp_properties.json has moved to https://code.visualstudio.com/docs/cpp/c-cpp-properties-schema-reference.
|
||||
@@ -0,0 +1 @@
|
||||
The documentation for enhanced colorization has moved to https://code.visualstudio.com/docs/cpp/colorization-cpp.
|
||||
@@ -3,6 +3,7 @@ node_modules
|
||||
|
||||
# ignore compliled typescript
|
||||
out
|
||||
dist
|
||||
|
||||
# ignore downloaded extension files and folders
|
||||
server
|
||||
@@ -17,4 +18,4 @@ install.lock
|
||||
*.vsix
|
||||
|
||||
# ignore vscode test
|
||||
.vscode-test/
|
||||
.vscode-test/
|
||||
|
||||
Vendored
+7
-6
@@ -13,9 +13,9 @@
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/out/**/*.js"
|
||||
"${workspaceFolder}/dist/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "compile",
|
||||
"preLaunchTask": "Compile Dev",
|
||||
},
|
||||
{
|
||||
"name": "Launch Tests",
|
||||
@@ -24,14 +24,14 @@
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceFolder}",
|
||||
"--extensionTestsPath=${workspaceFolder}/out/test"
|
||||
"--extensionTestsPath=${workspaceFolder}/out/test/unitTests"
|
||||
],
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/out/test/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "compile"
|
||||
"preLaunchTask": "TypeScript Compile"
|
||||
},
|
||||
{
|
||||
"name": "Node Attach",
|
||||
@@ -47,13 +47,14 @@
|
||||
"args": [
|
||||
"${workspaceFolder}/test/integrationTests/testAssets/SimpleCppProject",
|
||||
"--extensionDevelopmentPath=${workspaceFolder}",
|
||||
"--extensionTestsPath=${workspaceFolder}/out/test/integrationTests"
|
||||
"--extensionTestsPath=${workspaceFolder}/out/test/integrationTests/languageServer"
|
||||
],
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/out/test/**/*.js"
|
||||
]
|
||||
],
|
||||
"preLaunchTask": "Pretest"
|
||||
},
|
||||
]
|
||||
}
|
||||
Vendored
+28
-3
@@ -5,7 +5,6 @@
|
||||
"tasks": [
|
||||
{
|
||||
"label": "TypeScript Compile",
|
||||
"identifier": "compile",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
@@ -29,7 +28,6 @@
|
||||
},
|
||||
{
|
||||
"label": "TypeScript Lint",
|
||||
"identifier": "tslint",
|
||||
"group": "build",
|
||||
"isBackground": false,
|
||||
"type": "shell",
|
||||
@@ -53,8 +51,35 @@
|
||||
]
|
||||
},
|
||||
"dependsOn": [
|
||||
"compile"
|
||||
"TypeScript Compile"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Compile Dev",
|
||||
"group": "build",
|
||||
"isBackground": false,
|
||||
"type": "shell",
|
||||
"command": "npm",
|
||||
"args": [
|
||||
"run",
|
||||
"compileDev"
|
||||
],
|
||||
"problemMatcher": "$tsc-watch"
|
||||
},
|
||||
{
|
||||
"label": "Pretest",
|
||||
"group": "build",
|
||||
"isBackground": false,
|
||||
"type": "shell",
|
||||
"command": "npm",
|
||||
"args": [
|
||||
"run",
|
||||
"pretest"
|
||||
],
|
||||
"dependsOn": [
|
||||
"TypeScript Compile"
|
||||
],
|
||||
"problemMatcher": "$tsc-watch"
|
||||
}
|
||||
]
|
||||
}
|
||||
+30
-9
@@ -1,15 +1,36 @@
|
||||
obj/**
|
||||
|
||||
# ignore vscode settings for extension development
|
||||
.vscode/**
|
||||
typings/**
|
||||
out/test/**
|
||||
|
||||
# ignore binaries
|
||||
obj/**
|
||||
|
||||
# ignore source files
|
||||
tools/**
|
||||
notices/**
|
||||
test/**
|
||||
src/**
|
||||
**/*.map
|
||||
.gitignore
|
||||
|
||||
# ignore .js files that are webpacked or only used for development
|
||||
out/src/**
|
||||
out/tools/**
|
||||
|
||||
# ignore ts files in ui
|
||||
ui/*.ts
|
||||
|
||||
# ignore Azure-Pipelines files
|
||||
jobs/**
|
||||
|
||||
# ignore development files
|
||||
tsconfig.json
|
||||
test.tsconfig.json
|
||||
tslint.json
|
||||
webpack.config.js
|
||||
tscCompileList.txt
|
||||
gulpfile.js
|
||||
.gitattributes
|
||||
.gitignore
|
||||
CMakeLists.txt
|
||||
debugAdapters/install.lock*
|
||||
out/src/Debugger/copyScript.js
|
||||
tools/**
|
||||
out/tools/**
|
||||
notices/**
|
||||
typings/**
|
||||
**/*.map
|
||||
+391
-16
@@ -1,5 +1,380 @@
|
||||
# C/C++ for Visual Studio Code Change Log
|
||||
|
||||
## Version 0.25.0: August 21, 2019
|
||||
### New Features
|
||||
* Add `Find All References`. [#15](https://github.com/microsoft/vscode-cpptools/issues/15)
|
||||
* Add `-x86` options for `intelliSenseMode`. [#2275](https://github.com/microsoft/vscode-cpptools/issues/2275), [#2312](https://github.com/microsoft/vscode-cpptools/issues/2312)
|
||||
* Add `c++20` option to `cppStandard`. [#3448](https://github.com/microsoft/vscode-cpptools/issues/3448)
|
||||
* Add a code action for resolving missing includes via the `vcpkg` dependency manager. [PR #3791](https://github.com/microsoft/vscode-cpptools/pull/3791)
|
||||
|
||||
### Enhancements
|
||||
* Added support for compile commands:
|
||||
* `-iquote`. [#2088](https://github.com/microsoft/vscode-cpptools/issues/2088)
|
||||
* `-imacros`. [#2417](https://github.com/microsoft/vscode-cpptools/issues/2417)
|
||||
* `-idirafter`(`--include-directory-after` & `--include-directory-after=`). [#3713](https://github.com/microsoft/vscode-cpptools/issues/3713)
|
||||
* `-imsvc`. [#4032](https://github.com/microsoft/vscode-cpptools/issues/4032)
|
||||
* Switch to using VS Code's `Go to Declaration`. [#2959](https://github.com/microsoft/vscode-cpptools/issues/2959)
|
||||
* Added `compilerArgs` property setting. [PR #3950](https://github.com/microsoft/vscode-cpptools/pull/3950)
|
||||
* Added support for V3 API. [#3987](https://github.com/microsoft/vscode-cpptools/pull/3987)
|
||||
* Add `not supported` messages for ARM and Alpine containers. [PR #4027](https://github.com/microsoft/vscode-cpptools/pull/4027)
|
||||
* Add validation for paths from `env` variables. [#3912](https://github.com/microsoft/vscode-cpptools/issues/3912)
|
||||
|
||||
### Bug Fixes
|
||||
* Fix wrong type of `this` pointer. [#2303](https://github.com/microsoft/vscode-cpptools/issues/2303)
|
||||
* Fix previous cache path not deleted when new cache path is specified. Note that the VS Code bug [Microsoft/vscode#59391](https://github.com/microsoft/vscode/issues/59391) still occurs on the settings UI, but this fix should delete any incomplete path names as the extension receives changes from the cache path setting. [#3644](https://github.com/microsoft/vscode-cpptools/issues/3644).
|
||||
* Fix broken shell script when launch/attaching as root. [#3711](https://github.com/microsoft/vscode-cpptools/issues/3711)
|
||||
* Christian A. Jacobsen (@ChristianJacobsen) [PR MIEngine#906](https://github.com/microsoft/MIEngine/pull/906)
|
||||
* Fix ".H" files not appearing in include completion results on Linux/macOS. [#3744](https://github.com/microsoft/vscode-cpptools/issues/3744)
|
||||
* Fix `compile_commands.json` file changes not updated. [#3864](https://github.com/microsoft/vscode-cpptools/issues/3864).
|
||||
* Fix `Failed to parse` error message in the open file scenario. [#3888](https://github.com/microsoft/vscode-cpptools/issues/3888)
|
||||
* Fix loading the wrong symbols when creating or copying a file. [#3897](https://github.com/microsoft/vscode-cpptools/issues/3897)
|
||||
* Fix IntelliSense process crash in clang mode. [#3898](https://github.com/microsoft/vscode-cpptools/issues/3898)
|
||||
* Fix IntelliSense-based `Go to Definition` failing with `using namespace`. [#3902](https://github.com/microsoft/vscode-cpptools/issues/3902), [#4018](https://github.com/microsoft/vscode-cpptools/issues/4018)
|
||||
* Fix completion not showing results for smart pointers. [#3926](https://github.com/microsoft/vscode-cpptools/issues/3926), [#3930](https://github.com/microsoft/vscode-cpptools/issues/3930)
|
||||
* Fix `clang_format_path` cannot be set in workspace settings. [#3937](https://github.com/microsoft/vscode-cpptools/issues/3937)
|
||||
* Fix typos and grammar in documentation.
|
||||
* @pi1024e [PR #4014](https://github.com/microsoft/vscode-cpptools/pull/4014)
|
||||
* Fix NullReferenceException when unable to launch and an unresolved parameter exists in the string. This was causing a useless error message. [#4024](https://github.com/microsoft/vscode-cpptools/issues/4024), [#4090](https://github.com/microsoft/vscode-cpptools/issues/4090)
|
||||
* Fix debugger can't debug file whose folder path includes a parenthesis. [#4030](https://github.com/microsoft/vscode-cpptools/issues/4030)
|
||||
* Fix duplicate content appearing after formatting of a new file. [#4091](https://github.com/microsoft/vscode-cpptools/issues/4091)
|
||||
* Fix `files.exclude` bug on Windows. [#4095](https://github.com/microsoft/vscode-cpptools/issues/4095)
|
||||
* Fix NullReferenceException when `cwd` is null. [MIEngine#911](https://github.com/microsoft/MIEngine/issues/911)
|
||||
* Fix wrong IntelliSense for C++ types after editing within a function and after a lambda.
|
||||
|
||||
## Version 0.24.1: July 22, 2019
|
||||
### Bug Fixes
|
||||
* Fix an issue with the Outline not being populated when a file is opened. [#3877](https://github.com/microsoft/vscode-cpptools/issues/3877)
|
||||
* Update scopes used by semantic colorization. [PR# 3896](https://github.com/microsoft/vscode-cpptools/pull/3896)
|
||||
|
||||
## Version 0.24.0: July 3, 2019
|
||||
### New Features
|
||||
* Semantic colorization [Documentation](https://github.com/microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/colorization.md) [#230](https://github.com/microsoft/vscode-cpptools/issues/230)
|
||||
* Add `Rescan Workspace` command. [microsoft/vscode-cpptools-api#11](https://github.com/microsoft/vscode-cpptools-api/issues/11)
|
||||
|
||||
### Enhancements
|
||||
* Configuration UI editor improvements:
|
||||
* Add list of detected compiler paths. [PR #3708](https://github.com/microsoft/vscode-cpptools/pull/3708)
|
||||
* Enable selecting/editing of other configurations and add "Advanced Settings" section. [PR #3732](https://github.com/microsoft/vscode-cpptools/pull/3732)
|
||||
* Enable `envFile` for `cppdbg`. [PR #3723](https://github.com/microsoft/vscode-cpptools/pull/3723)
|
||||
* Change the default path value of `C_Cpp.intelliSenseCachePath`. [#3347](https://github.com/microsoft/vscode-cpptools/issues/3347) [#3664](https://github.com/microsoft/vscode-cpptools/issues/3664)
|
||||
* Change `C_Cpp.clang_format_path` to `machine` scope. [#3774](https://github.com/microsoft/vscode-cpptools/issues/3774)
|
||||
* Add validation to the advanced configuration UI settings. [PR #3838](https://github.com/microsoft/vscode-cpptools/pull/3838)
|
||||
* Add `Current Configuration` to `C/C++: Log Diagnostics`. [PR #3866](https://github.com/microsoft/vscode-cpptools/pull/3866)
|
||||
|
||||
### Bug Fixes
|
||||
* Fix for gdb `follow-fork-mode` `child` not working. [#2738](https://github.com/microsoft/vscode-cpptools/issues/2738)
|
||||
* Fix IntelliSense process crash on hover with certain arrays. [#3081](https://github.com/Microsoft/vscode-cpptools/issues/3081)
|
||||
* Fix IntelliSense-based `Go to Definition` for goto labels. [#3111](https://github.com/microsoft/vscode-cpptools/issues/3111)
|
||||
* Fix IntelliSense behaving incorrectly when files are opened with different casing on Windows. [#3229](https://github.com/microsoft/vscode-cpptools/issues/3229)
|
||||
* Fix user defined literals crashing IntelliSense in clang/gcc mode. [#3481](https://github.com/microsoft/vscode-cpptools/issues/3481)
|
||||
* Improve `sourceFileMap` to be more dynamic. [#3504](https://github.com/microsoft/vscode-cpptools/issues/3504)
|
||||
* Fix IntelliSense-based hover document comments being shown for invalid declarations not used by the current translation unit. [#3596](https://github.com/microsoft/vscode-cpptools/issues/3596)
|
||||
* Fix `Go to Definition` when is `void` missing in the parameter list of a function definition a .c file. [#3609](https://github.com/microsoft/vscode-cpptools/issues/3609)
|
||||
* Fix configuration validation of compiler path and IntelliSense mode compatibility for `clang-cl.exe` compiler. [#3637](https://github.com/microsoft/vscode-cpptools/issues/3637)
|
||||
* Fix resolving `${workspaceFolderBasename}` and add `${workspaceStorage}`. [#3642](https://github.com/microsoft/vscode-cpptools/issues/3642)
|
||||
* Fix IntelliSense-based `Go to Definition` performance issue due to extra database iteration. [#3655](https://github.com/microsoft/vscode-cpptools/issues/3655)
|
||||
* Fix `SourceRequest` causing debugging to stop with `NotImplementedException`. [#3662](https://github.com/microsoft/vscode-cpptools/issues/3662)
|
||||
* Fix typo in `intelliSenseMode` description.
|
||||
* Karsten Thoms (@kthoms) [PR #3682](https://github.com/microsoft/vscode-cpptools/pull/3682)
|
||||
* Fix invalid warning with typedef enums in .c files. [#3685](https://github.com/microsoft/vscode-cpptools/issues/3685)
|
||||
* Fix incorrect `keyword` completion occurring for pragma `#keyword`. [#3690](https://github.com/microsoft/vscode-cpptools/issues/3690)
|
||||
* Fix problem matcher to show fatal errors from GCC [#3712](https://github.com/microsoft/vscode-cpptools/issues/3712)
|
||||
* Fix multi-root folders with the same name sharing the same browse database. [PR #3715](https://github.com/microsoft/vscode-cpptools/pull/3715)
|
||||
* Fix `remoteProcessPicker` on Windows. [#3758](https://github.com/microsoft/vscode-cpptools/issues/3758)
|
||||
* Fix crash when tag parsing Objective-C code. [#3776](https://github.com/microsoft/vscode-cpptools/issues/3776)
|
||||
* Fix duplicate slashes getting added to `c_cpp_properties.json`. [PR #3778](https://github.com/microsoft/vscode-cpptools/pull/3778)
|
||||
* Fix `envFile` variable substitution. [#3836](https://github.com/microsoft/vscode-cpptools/issues/3836)
|
||||
* Fix missing headers popup. [PR #3840](https://github.com/microsoft/vscode-cpptools/pull/3840)
|
||||
* Fix multiple anonymous unions not showing correctly in Locals while debugging. [MIEngine#820](https://github.com/microsoft/MIEngine/issues/820)
|
||||
* Fix pause not working when using `DebugServer`/`MIDebuggerServerAddress` on Linux and macOS. [MIEngine#844](https://github.com/microsoft/MIEngine/issues/844)
|
||||
* Improvements to CPU and memory usage when editing.
|
||||
|
||||
## Version 0.23.1: May 13, 2019
|
||||
### Bug Fixes
|
||||
* Fix `launch.json` creation when `intelliSenseEngine` is `"Disabled"`. [#3583](https://github.com/microsoft/vscode-cpptools/issues/3583)
|
||||
* Fix C/C++ commands not working if the language service isn't activated. [#3615](https://github.com/microsoft/vscode-cpptools/issues/3615)
|
||||
* Fix missing extension `"Details"` page. [#3621](https://github.com/microsoft/vscode-cpptools/issues/3621)
|
||||
* Fix some random crashes related to IntelliSense inactive region processing.
|
||||
|
||||
## Version 0.23.0: May 6, 2019
|
||||
### New Features
|
||||
* Add a configuration UI editor to edit IntelliSense settings defined in the underlying `c_cpp_properties.json` file. [PR #3479](https://github.com/Microsoft/vscode-cpptools/pull/3479), [PR #3487](https://github.com/Microsoft/vscode-cpptools/pull/3487), [PR #3519](https://github.com/Microsoft/vscode-cpptools/pull/3519), [#3524](https://github.com/Microsoft/vscode-cpptools/issues/3524), [PR #3563](https://github.com/Microsoft/vscode-cpptools/pull/3563), [#3526](https://github.com/Microsoft/vscode-cpptools/issues/3526)
|
||||
* Add a new command `C/C++: Edit configurations (UI)` to open the UI editor.
|
||||
* Replace the `C/C++: Edit configurations...` command with `C/C++: Edit configurations (JSON)` to open `c_cpp_properties.json`.
|
||||
* The default whether to open the UI editor or JSON file is based on the `workbench.settings.editor` setting.
|
||||
* Add command `C/C++: Log Diagnostics` to log language service diagnostics. [PR #3489](https://github.com/Microsoft/vscode-cpptools/pull/3489)
|
||||
* Add support for `.env` files for `cppvsdbg`. [#3490](https://github.com/Microsoft/vscode-cpptools/issues/3490)
|
||||
|
||||
### Other Changes
|
||||
* Enable flag `/permissive-` as an argument to `compilerPath` with `cl.exe`. [#1589](https://github.com/Microsoft/vscode-cpptools/issues/1589), [#3446](https://github.com/Microsoft/vscode-cpptools/issues/3446)
|
||||
* Configuration squiggles for `c_cpp_properties.json` now validates if the setting values of `compilerPath` and `intelliSenseMode` match on Windows. [#2983](https://github.com/Microsoft/vscode-cpptools/issues/2983)
|
||||
* Enable `-fms-extensions` to be used as an argument to `compilerPath` on Linux/Mac. [#3063](https://github.com/Microsoft/vscode-cpptools/issues/3063)
|
||||
* Change the default value of `C_Cpp.intelliSenseEngineFallback` setting to `Disabled`. [#3165](https://github.com/Microsoft/vscode-cpptools/issues/3165)
|
||||
* Add squiggle when `compilerPath` uses spaces and arguments without `"`. [#3357](https://github.com/Microsoft/vscode-cpptools/issues/3357)
|
||||
* Change the `Disabled` value for `C_Cpp.errorSquiggles` to stop showing missing header squiggles. [#3361](https://github.com/Microsoft/vscode-cpptools/issues/3361)
|
||||
* Add `enableConfigurationSquiggles` setting to allow squiggles to be disabled for `c_cpp_properties.json`. [#3403](https://github.com/Microsoft/vscode-cpptools/issues/3403)
|
||||
* Switch to using the `installExtension` command for offline/insider vsix installing (to reduce install failures). [#3408](https://github.com/Microsoft/vscode-cpptools/issues/3408)
|
||||
* Add a better example to the description of `C_Cpp.clang_format_style` and `C_Cpp.clang_format_fallback_style`. [#3419](https://github.com/Microsoft/vscode-cpptools/issues/3419)
|
||||
* Add a new (default) value of `EnabledIfIncludesResolve` to `C_Cpp.errorSquiggles`, which only shows error squiggles if include headers are successfully resolved. [PR #3421](https://github.com/Microsoft/vscode-cpptools/pull/3421)
|
||||
* Disable debug heap by default with cppvsdbg. [#3484](https://github.com/Microsoft/vscode-cpptools/issues/3484)
|
||||
* Reported by Djoulihen (@Djoulihen)
|
||||
* Enable configuration squiggles for paths delimited by semicolons. [PR #3517](https://github.com/Microsoft/vscode-cpptools/pull/3517)
|
||||
* Don't show release notes if the extension has never been installed before. [#3533](https://github.com/Microsoft/vscode-cpptools/issues/3533)
|
||||
* Remove IntelliSense fallback code actions.
|
||||
|
||||
### Bug Fixes
|
||||
* Fix browsing for functions with BOOST_FOREACH. [#953](https://github.com/Microsoft/vscode-cpptools/issues/953)
|
||||
* Fix code action sometimes not appearing over a squiggled identifier. [#1436](https://github.com/microsoft/vscode-cpptools/issues/1436)
|
||||
* Work around issue with VS Code not treating `.C` files as C++ files [Microsoft/vscode#59369](https://github.com/Microsoft/vscode/issues/59369) -- `.C` files become associated by name in `files.associations`. [#2558](https://github.com/Microsoft/vscode-cpptools/issues/2558)
|
||||
* Fix various IntelliSense parsing bugs. [#2824](https://github.com/Microsoft/vscode-cpptools/issues/2824), [#3110](https://github.com/Microsoft/vscode-cpptools/issues/3110), [#3168](https://github.com/Microsoft/vscode-cpptools/issues/3168)
|
||||
* Preserve newlines in documentation comments. [#2937](https://github.com/Microsoft/vscode-cpptools/issues/2937)
|
||||
* Fix documentation comments above multi-line templates (and some other issues). [#3162](https://github.com/Microsoft/vscode-cpptools/issues/3162)
|
||||
* Fix "Extension causes high cpu load" due to module loading. [#3213](https://github.com/Microsoft/vscode-cpptools/issues/3213)
|
||||
* Fix auto-removal of compiler-provided paths in `includePath` when they end with a directory separator on Windows. [#3245](https://github.com/Microsoft/vscode-cpptools/issues/3245)
|
||||
* Fix duplicate compiler build tasks appearing when `compilerPath` has arguments. [PR #3360](https://github.com/Microsoft/vscode-cpptools/pull/3360)
|
||||
* Fix environment variables not resolving with `C_Cpp.intelliSenseCachePath`. [#3367](https://github.com/Microsoft/vscode-cpptools/issues/3367)
|
||||
* Fix the formatting of snippets text. [#3376](https://github.com/Microsoft/vscode-cpptools/issues/3376)
|
||||
* Fix the default `AccessModifierOffset` used when formatting. [#3376](https://github.com/Microsoft/vscode-cpptools/issues/3376)
|
||||
* Fix null reference during initialization when using custom configuration providers. [PR #3377](https://github.com/Microsoft/vscode-cpptools/pull/3377)
|
||||
* Fix symbol parsing when `__MINGW_ATTRIB_*` is used. [#3390](https://github.com/Microsoft/vscode-cpptools/issues/3390)
|
||||
* Fix `compile_commands.json` configuration prompt being disabled per user instead of per folder. [PR #3399](https://github.com/Microsoft/vscode-cpptools/pull/3399)
|
||||
* Fix `.cmd` and `.bat` files not working for `compilerPath` on Windows. [#3428](https://github.com/Microsoft/vscode-cpptools/issues/3428)
|
||||
* Fix `compilerPath` with arguments that are surrounded by quotes. [#3428](https://github.com/Microsoft/vscode-cpptools/issues/3428)
|
||||
* Fix documentation comments interpreting special characters as markdown. [#3441](https://github.com/Microsoft/vscode-cpptools/issues/3441)
|
||||
* Fix hover using the configuration of the active document instead of the hovered document. [#3452](https://github.com/Microsoft/vscode-cpptools/issues/3452)
|
||||
* Fix `c_cpp_properties.json` squiggles when the configuration name has regex characters. [PR #3478](https://github.com/Microsoft/vscode-cpptools/pull/3478)
|
||||
* Use the `editor.tabSize` setting instead of `2` when creating build tasks. [PR #3486](https://github.com/Microsoft/vscode-cpptools/pull/3486)
|
||||
* Fix some potential crashes on hover. [#3509](https://github.com/Microsoft/vscode-cpptools/issues/3509)
|
||||
* Fix for `NullReferenceException` occurring when `"args"` is not specified in `launch.json`. [#3532](https://github.com/Microsoft/vscode-cpptools/issues/3532)
|
||||
* Fix `Go to Definition` giving no results when IntelliSense doesn't find the symbol. [#3549](https://github.com/Microsoft/vscode-cpptools/issues/3549)
|
||||
* Fix configuration squiggles with trailing backslashes. [PR #3573](https://github.com/Microsoft/vscode-cpptools/pull/3573)
|
||||
* Fix `includePath` code actions, configuration prompts, and the `C/C++: Change configuration provider...` command. [PR #3576](https://github.com/Microsoft/vscode-cpptools/pull/3576)
|
||||
* Fix randomly occurring crash (that could occur when opening files while IntelliSense squiggles are pending).
|
||||
* Fix crash on hover (that could occur when document comments have blank lines).
|
||||
* Fix icon of parameters in completion results.
|
||||
|
||||
## Version 0.22.1: March 21, 2019
|
||||
* Fix `tasks.json` with single-line comments being overwritten when `Build and Debug Active File` is used. [#3327](https://github.com/Microsoft/vscode-cpptools/issues/3327)
|
||||
* Fix an invalid `compilerPath` property getting added to `tasks.json` after doing `Configure Task` with a C/C++ compiler.
|
||||
* Add IntelliSense caching for macOS 10.13 or later (0.22.0 only supported Windows and Linux).
|
||||
|
||||
## Version 0.22.0: March 19, 2019
|
||||
### Major Changes
|
||||
* Add warning squiggles for invalid properties and paths in `c_cpp_properties.json`. [#2799](https://github.com/Microsoft/vscode-cpptools/issues/2799), [PR #3283](https://github.com/Microsoft/vscode-cpptools/pull/3283)
|
||||
* Add C/C++ compiler build tasks for compiling the active source file, with support for `F5` debugging and the `Build and Debug Active File` context menu command. [PR #3118](https://github.com/Microsoft/vscode-cpptools/pull/3118), [PR #3244](https://github.com/Microsoft/vscode-cpptools/pull/3244)
|
||||
* Add AutoPCH support to reduce IntelliSense parsing time, with `C_Cpp.intelliSenseCachePath` and `C_Cpp.intelliSenseCacheSize` settings. It isn't enabled for Mac yet. [PR #3184](https://github.com/Microsoft/vscode-cpptools/pull/3184)
|
||||
|
||||
### Minor Changes
|
||||
* Fix IntelliSense not working on Windows when the username has a space in it and file `C:\Users\<firstname>` exists. [#1377](https://github.com/Microsoft/vscode-cpptools/issues/1377), [#2114](https://github.com/Microsoft/vscode-cpptools/issues/2114), [#2176](https://github.com/Microsoft/vscode-cpptools/issues/2176), [#3052](https://github.com/Microsoft/vscode-cpptools/issues/3052), [#3139](https://github.com/Microsoft/vscode-cpptools/issues/3139)
|
||||
* Enable `${command:cpptools.activeConfigName}` in tasks. [#1524](https://github.com/Microsoft/vscode-cpptools/issues/1524)
|
||||
* Fix bugs with squiggles and IntelliSense updating after edits. [#1779](https://github.com/Microsoft/vscode-cpptools/issues/1779), [#3124](https://github.com/Microsoft/vscode-cpptools/issues/3124), [#3260](https://github.com/Microsoft/vscode-cpptools/issues/3260)
|
||||
* Fix formatting (and other non-IntelliSense operations) being blocked by IntelliSense processing. [#1928](https://github.com/Microsoft/vscode-cpptools/issues/1928)
|
||||
* Fix completion when the start of an identifier matches a keyword. [#1986](https://github.com/Microsoft/vscode-cpptools/issues/1986)
|
||||
* Fix auto-removal of compiler-provided paths in `includePath`. [#2177](https://github.com/Microsoft/vscode-cpptools/issues/2177)
|
||||
* Fix crash on Windows when 8.3 filenames are used. [#2453](https://github.com/Microsoft/vscode-cpptools/issues/2453), [#3104](https://github.com/Microsoft/vscode-cpptools/issues/3104)
|
||||
* Add support for `Scope::Member` scoped symbol searches. [#2484](https://github.com/Microsoft/vscode-cpptools/issues/2484)
|
||||
* Fix signature help active parameter selection when parameter names are missing or subsets of each other. [#2952](https://github.com/Microsoft/vscode-cpptools/issues/2952)
|
||||
* Fix `--enable-pretty-printing` with `gdb` when complex objects are used as keys in maps. [#3024](https://github.com/Microsoft/vscode-cpptools/issues/3024)
|
||||
* Fix IntelliSense-based `Go to Definition` for `noexcept` methods. [#3060](https://github.com/Microsoft/vscode-cpptools/issues/3060)
|
||||
* Render macro hover expansions as C/C++. [#3075](https://github.com/Microsoft/vscode-cpptools/issues/3075)
|
||||
* Enable completion after `struct` when manually invoked. [#3080](https://github.com/Microsoft/vscode-cpptools/issues/3080)
|
||||
* Add `C_Cpp.suggestSnippets` setting to disable language server snippets. [#3083](https://github.com/Microsoft/vscode-cpptools/issues/3083)
|
||||
* Show a prompt for changing `C_Cpp.updateChannel` to `Insiders`. [#3089](https://github.com/Microsoft/vscode-cpptools/issues/3089)
|
||||
* lh123 (@lh123) [PR #3221](https://github.com/Microsoft/vscode-cpptools/pull/3221)
|
||||
* Fix `compilerPath` not getting priority over the `compile_commands.json` compiler. [#3102](https://github.com/Microsoft/vscode-cpptools/issues/3102)
|
||||
* Fix Linux `compile_commands.json` compiler querying with relative paths. [#3112](https://github.com/Microsoft/vscode-cpptools/issues/3112)
|
||||
* Allow `*` in `includePath` to apply to `browse.path` when `browse.path` is not specified. [#3121](https://github.com/Microsoft/vscode-cpptools/issues/3121)
|
||||
* Tucker Kern (@mill1000) [PR #3122](https://github.com/Microsoft/vscode-cpptools/pull/3122)
|
||||
* Disable `(` and `<` completion commit characters. [#3127](https://github.com/Microsoft/vscode-cpptools/issues/3127)
|
||||
* Add Chinese translations for command titles. [PR #3128](https://github.com/Microsoft/vscode-cpptools/pull/3128)
|
||||
* Fix remote process picker bug. [#2585](https://github.com/Microsoft/vscode-cpptools/issues/2585), [#3150](https://github.com/Microsoft/vscode-cpptools/issues/3150)
|
||||
* Fix command not found and empty `c_cpp_properties.json` if activation is too slow. [#3160](https://github.com/Microsoft/vscode-cpptools/issues/3160), [#3176](https://github.com/Microsoft/vscode-cpptools/issues/3176)
|
||||
* Fix `cppvsdbg` debugger showing `"An unspecified error has occurred."` for structured binding variables. [#3197](https://github.com/Microsoft/vscode-cpptools/issues/3197)
|
||||
* Fix bugs with the Insider reload prompt appearing when it shouldn't. [#3206](https://github.com/Microsoft/vscode-cpptools/issues/3206)
|
||||
* Fix variable expansion (e.g. `${env.HOME}`) not working when `${default}` is used in `c_cpp_properties.json`. [#3309](https://github.com/Microsoft/vscode-cpptools/issues/3309)
|
||||
* Fix other unreported IntelliSense engine bugs.
|
||||
|
||||
## Version 0.21.0: January 23, 2019
|
||||
### New Features
|
||||
* Add documentation comments for hover, completion, and signature help. [#399](https://github.com/Microsoft/vscode-cpptools/issues/399)
|
||||
* Add completion committing for methods after `(`. [#1184](https://github.com/Microsoft/vscode-cpptools/issues/1184)
|
||||
* Add macro expansions to hover. [#1734](https://github.com/Microsoft/vscode-cpptools/issues/1734)
|
||||
* Add support for `__int128_t` and `__uint128_t` types. [#1815](https://github.com/Microsoft/vscode-cpptools/issues/1815)
|
||||
* Add Italian translations for command titles.
|
||||
* Julien Russo (@Dotpys) [PR #2663](https://github.com/Microsoft/vscode-cpptools/pull/2663)
|
||||
* Add icons for operators, structs/unions, enum values, template arguments, and macros. [#2849](https://github.com/Microsoft/vscode-cpptools/issues/2849)
|
||||
* Change `#include` completion to show individual folders instead of the entire paths, fixing previous performance problems. [#2836](https://github.com/Microsoft/vscode-cpptools/issues/2836)
|
||||
* Add text `(declaration)`, `(typedef)`, `(type alias)`, and `(union)` to symbols. [#2851](https://github.com/Microsoft/vscode-cpptools/issues/2851)
|
||||
* Add a refresh button to the `Attach to Process` picker. [#2885](https://github.com/Microsoft/vscode-cpptools/issues/2885)
|
||||
* Matt Bise (@mbise1993) [PR #2895](https://github.com/Microsoft/vscode-cpptools/pull/2895)
|
||||
* Add completion committing for templates after `<`. [#2953](https://github.com/Microsoft/vscode-cpptools/issues/2953)
|
||||
|
||||
### Bug Fixes
|
||||
* Add the Microsoft digital signature to Windows binaries to avoid getting incorrectly flagged by virus scanners. [#1103](https://github.com/Microsoft/vscode-cpptools/issues/1103), [#2970](https://github.com/Microsoft/vscode-cpptools/issues/2970)
|
||||
* Fix bugs when UTF-8 characters > 1 byte are used. [#1504](https://github.com/Microsoft/vscode-cpptools/issues/1504), [#1525](https://github.com/Microsoft/vscode-cpptools/issues/1525), [#2034](https://github.com/Microsoft/vscode-cpptools/issues/2034), [#2082](https://github.com/Microsoft/vscode-cpptools/issues/2082), [#2883](https://github.com/Microsoft/vscode-cpptools/issues/2883)
|
||||
* Fix some IntelliSense process crashes. [#1785](https://github.com/Microsoft/vscode-cpptools/issues/1785), [#2913](https://github.com/Microsoft/vscode-cpptools/issues/2913)
|
||||
* Fix several incorrect IntelliSense error squiggles. [#1942](https://github.com/Microsoft/vscode-cpptools/issues/1942), [#2422](https://github.com/Microsoft/vscode-cpptools/issues/2422), [#2474](https://github.com/Microsoft/vscode-cpptools/issues/2474), [#2478](https://github.com/Microsoft/vscode-cpptools/issues/2478), [#2597](https://github.com/Microsoft/vscode-cpptools/issues/2597), [#2763](https://github.com/Microsoft/vscode-cpptools/issues/2763)
|
||||
* Fix some main process crashes. [#2505](https://github.com/Microsoft/vscode-cpptools/issues/2505), [#2768](https://github.com/Microsoft/vscode-cpptools/issues/2768)
|
||||
* Fix incorrect IntelliSense error with Mac clang 10.0 libraries. [#2608](https://github.com/Microsoft/vscode-cpptools/issues/2608)
|
||||
* Fix completion not working in template specializations. [#2620](https://github.com/Microsoft/vscode-cpptools/issues/2620)
|
||||
* Fix incorrect completions after Enter is used after struct, class, etc. [#2734](https://github.com/Microsoft/vscode-cpptools/issues/2734)
|
||||
* Fix memory "leak" when parsing a large workspace. [#2737](https://github.com/Microsoft/vscode-cpptools/issues/2737)
|
||||
* Fix IntelliSense-based `Go to Definition` with overloads that return a template with a default param (e.g. vector) [#2736](https://github.com/Microsoft/vscode-cpptools/issues/2736)
|
||||
* Fix `Go to Definition` when `__catch()`, `_NO_EXCEPT_DEBUG`, or `_LIBCPP_BEGIN_NAMESPACE_STD` is used. [#2761](https://github.com/Microsoft/vscode-cpptools/issues/2761), [#2766](https://github.com/Microsoft/vscode-cpptools/issues/2766)
|
||||
* Fix `Go to Definition` when `method(void)` is used. [#2802](https://github.com/Microsoft/vscode-cpptools/issues/2802)
|
||||
* Fix error `"TypeError: Cannot read property 'map' of undefined at asCompletionResult"`. [#2807](https://github.com/Microsoft/vscode-cpptools/issues/2807)
|
||||
* Fix quotes around defines not supported for custom configuration providers. [#2820](https://github.com/Microsoft/vscode-cpptools/issues/2820)
|
||||
* Fix PowerShell bug on Win7. [#2822](https://github.com/Microsoft/vscode-cpptools/issues/2822)
|
||||
* Fix Tag Parser completion details missing keywords (i.e. `using`, `class`, `#define`, etc.). [#2850](https://github.com/Microsoft/vscode-cpptools/issues/2850)
|
||||
* Fix problem with empty recursive include paths. [#2855](https://github.com/Microsoft/vscode-cpptools/issues/2855)
|
||||
* Fix `NullReferenceException` on debugger launch with VS Code Insiders. [#2858](https://github.com/Microsoft/vscode-cpptools/issues/2858), [PR Microsoft/MIEngine#810](https://github.com/Microsoft/MIEngine/pull/810)
|
||||
* Fix IntelliSense errors with template argument deduction. [#2907](https://github.com/Microsoft/vscode-cpptools/issues/2907), [#2912](https://github.com/Microsoft/vscode-cpptools/issues/2912)
|
||||
* Retry Insider VSIX downloading with `http.proxySupport` `"off"`. [#2927](https://github.com/Microsoft/vscode-cpptools/issues/2927)
|
||||
* Fix snippet completions being offered when they shouldn't be. [#2942](https://github.com/Microsoft/vscode-cpptools/issues/2942)
|
||||
* Set the `editor.wordBasedSuggestions` to `false` by default to prevent incorrect completions. [#2943](https://github.com/Microsoft/vscode-cpptools/issues/2943)
|
||||
* Fix IntelliSense-based `Go to Definition` for functions with function pointer parameters. [#2981](https://github.com/Microsoft/vscode-cpptools/issues/2981)
|
||||
* Fix `<` incorrectly triggering completions. [#2985](https://github.com/Microsoft/vscode-cpptools/issues/2985)
|
||||
* Fix recursive includes not adding paths used by `forcedInclude` files. [#2986](https://github.com/Microsoft/vscode-cpptools/issues/2986)
|
||||
* Fix crash when `//` is used in a recursive `includePath`. [#2987](https://github.com/Microsoft/vscode-cpptools/issues/2987)
|
||||
* Fix compiler in `compile_commands.json` not taking precedence over the `Cpp.default.compilerPath`. [#2793](https://github.com/Microsoft/vscode-cpptools/issues/2793)
|
||||
* Fix `#include` completion not working for symlinks. [#2843](https://github.com/Microsoft/vscode-cpptools/issues/2843)
|
||||
* Fix IntelliSense-based `Go to Definition` for `const` methods. [#3014](https://github.com/Microsoft/vscode-cpptools/issues/3014)
|
||||
* Support `C_Cpp.updateChannel` for VS Code Exploration builds.
|
||||
|
||||
## Version 0.20.1: October 31, 2018
|
||||
* Fix IntelliSense-based `Go to Declaration` when there's only a definition in a TU. [#2743](https://github.com/Microsoft/vscode-cpptools/issues/2743)
|
||||
* Fix `#include` completion for standalone header files. [#2744](https://github.com/Microsoft/vscode-cpptools/issues/2744)
|
||||
* Fix the highest hitting main process crash.
|
||||
* Fix IntelliSense process crash with completion.
|
||||
|
||||
## Version 0.20.0: October 30, 2018
|
||||
* Add IntegratedTerminal support for Linux and Windows. [#35](https://github.com/microsoft/vscode-cpptools/issues/35)
|
||||
* Unify Visual Studio Code debug protocol parsing by using a shared library with Visual Studio.
|
||||
* Fix IntelliSense-based `Go to Definition` on overloads (in the same TU). [#1071](https://github.com/Microsoft/vscode-cpptools/issues/1071)
|
||||
* Fix inactive regions not being disabled when falling back to the Tag Parser. [#2181](https://github.com/Microsoft/vscode-cpptools/issues/2181)
|
||||
* Fix `#include` completion not working with `compile_commands.json` or custom configuration providers. [#2242](https://github.com/Microsoft/vscode-cpptools/issues/2242)
|
||||
* Fix IntelliSense failing if recursive includes removes all paths. [#2442](https://github.com/Microsoft/vscode-cpptools/issues/2442)
|
||||
* Fix incorrect IntelliSense errors with MinGW (stop using `-fms-extensions` by default). [#2443](https://github.com/Microsoft/vscode-cpptools/issues/2443), [#2623](https://github.com/Microsoft/vscode-cpptools/issues/2623)
|
||||
* Fix error squiggles sometimes not updating after typing. [#2448](https://github.com/Microsoft/vscode-cpptools/issues/2448)
|
||||
* Add support for Mac framework paths in `compile_commands.json`. [#2508](https://github.com/Microsoft/vscode-cpptools/issues/2508)
|
||||
* Fix IntelliSense-based `Go to Definition` falling back to the Tag Parser for definitions not in the TU. [#2536](https://github.com/Microsoft/vscode-cpptools/issues/2536), [#2677](https://github.com/Microsoft/vscode-cpptools/issues/2677)
|
||||
* Fix IntelliSense-based `Go to Definition` on the identifier of a definition with no declaration. [#2573](https://github.com/Microsoft/vscode-cpptools/issues/2573)
|
||||
* Fix IntelliSense-based `Go to Definition` not falling back to the declaration (in certain cases). [#2574](https://github.com/Microsoft/vscode-cpptools/issues/2574)
|
||||
* Fix IntelliSense-based `Go to Definition` going to the wrong location after edits are made. [#2579](https://github.com/Microsoft/vscode-cpptools/issues/2579)
|
||||
* Fix `Go to Definition` when the `intelliSenseEngineFallback` is `Disabled` and `#include`s are missing. [#2583](https://github.com/Microsoft/vscode-cpptools/issues/2583)
|
||||
* Fix empty `C_Cpp.default.*` settings not being used. [#2584](https://github.com/Microsoft/vscode-cpptools/issues/2584)
|
||||
* Fix quoting around `ssh`'s command (for the debugger). [#2585](https://github.com/Microsoft/vscode-cpptools/issues/2585)
|
||||
* Fix crash on hover (and `Go to Definition`) when using the `Tag Parser`. [#2586](https://github.com/Microsoft/vscode-cpptools/issues/2586)
|
||||
* Fix errors when a workspace folder isn't open. [#2613](https://github.com/Microsoft/vscode-cpptools/issues/2613), [#2691](https://github.com/Microsoft/vscode-cpptools/issues/2691)
|
||||
* Fix `-isystem` without a space after getting ignored in `compile_comamands.json`. [#2629](https://github.com/Microsoft/vscode-cpptools/issues/2629)
|
||||
* Fix Insiders update channel installation bugs. [#2636](https://github.com/Microsoft/vscode-cpptools/issues/2636), [#2685](https://github.com/Microsoft/vscode-cpptools/issues/2685)
|
||||
* Fix IntelliSense-based `Go to Declaration` falling back to the Tag Parser if the definition is also in the TU. [#2642](https://github.com/Microsoft/vscode-cpptools/issues/2642)
|
||||
* Fix the `Disabled` `intelliSenseEngine` setting not working with custom configuration providers. [#2656](https://github.com/Microsoft/vscode-cpptools/issues/2656)
|
||||
|
||||
## Version 0.19.0: September 27, 2018
|
||||
* Change the symbol database to update without needing to save. [#202](https://github.com/Microsoft/vscode-cpptools/issues/202)
|
||||
* Enable IntelliSense-based `Go to Definition` for the current translation unit, including local variables and overloaded operators. [#255](https://github.com/Microsoft/vscode-cpptools/issues/255), [#979](https://github.com/Microsoft/vscode-cpptools/issues/979)
|
||||
* Improved the `Go to Definition` performance with large workspaces and files with lots of `#include`s. [#273](https://github.com/Microsoft/vscode-cpptools/issues/273)
|
||||
* Disable `Go to Definition` for invalid tokens, e.g. comments, strings, keywords, etc. [#559](https://github.com/Microsoft/vscode-cpptools/issues/559)
|
||||
* Add `C_Cpp.updateChannel` setting for easier access to Insider builds of the extension. [#1526](https://github.com/Microsoft/vscode-cpptools/issues/1526)
|
||||
* Add support for v2 of the configuration provider API. [#2237](https://github.com/Microsoft/vscode-cpptools/issues/2237)
|
||||
* Fix bug with parsing definitions in `compile_commands.json`. [#2305](https://github.com/Microsoft/vscode-cpptools/issues/2305)
|
||||
* Fix `sh` failure when attaching to a remote Linux process. [#2444](https://github.com/Microsoft/vscode-cpptools/issues/2444)
|
||||
* Fix incorrect default `cl.exe` macro. [PR #2468](https://github.com/Microsoft/vscode-cpptools/issues/2468)
|
||||
* Fix multiple bugs with the symbols in the Outline view not updating correctly. [#2477](https://github.com/Microsoft/vscode-cpptools/issues/2477), [#2500](https://github.com/Microsoft/vscode-cpptools/issues/2500), [#2504](https://github.com/Microsoft/vscode-cpptools/issues/2504)
|
||||
* Add support for `workspaceFolderBasename` expansion. [#2491](https://github.com/Microsoft/vscode-cpptools/issues/2491)
|
||||
* Gabriel Arjones (@g-arjones) [PR #2495](https://github.com/Microsoft/vscode-cpptools/pull/2495), [PR #2503](https://github.com/Microsoft/vscode-cpptools/pull/2503)
|
||||
* Fix bug with variable resolution. [#2532](https://github.com/Microsoft/vscode-cpptools/issues/2532)
|
||||
* Fix off-by-one bug with hover and `Go to Definition`. [#2535](https://github.com/Microsoft/vscode-cpptools/issues/2535)
|
||||
* Fix [Microsoft/vscode#54213](https://github.com/Microsoft/vscode/issues/54213)
|
||||
|
||||
## Version 0.18.1: August 17, 2018
|
||||
* Fix 0.18.0 regression causing non-MinGW compilers to use `-fms-extensions` on Windows. [#2424](https://github.com/Microsoft/vscode-cpptools/issues/2424), [#2425](https://github.com/Microsoft/vscode-cpptools/issues/2425)
|
||||
|
||||
## Version 0.18.0: August 17, 2018
|
||||
### New Features
|
||||
* Add the `C_Cpp.intelliSenseEngine` setting value of `Disabled` (for users who only use the debugger). [#785](https://github.com/Microsoft/vscode-cpptools/issues/785)
|
||||
* Add `C_Cpp.workspaceSymbols` setting with default `Just My Code` to filter out system header symbols. [#1119](https://github.com/Microsoft/vscode-cpptools/issues/1119), [#2320](https://github.com/Microsoft/vscode-cpptools/issues/2320)
|
||||
* Add `C_Cpp.inactiveRegionForegroundColor` and `C_Cpp.inactiveRegionBackgroundColor` settings. [#1620](https://github.com/Microsoft/vscode-cpptools/issues/1620), [#2212](https://github.com/Microsoft/vscode-cpptools/issues/2212)
|
||||
* John Patterson (@john-patterson) [PR #2308](https://github.com/Microsoft/vscode-cpptools/pull/2308)
|
||||
* Add `gcc-x64` `intelliSenseMode` and send the correct clang or gcc version to our parser, fixing various IntelliSense errors. [#2112](https://github.com/Microsoft/vscode-cpptools/issues/2112), [#2175](https://github.com/Microsoft/vscode-cpptools/issues/2175), [#2260](https://github.com/Microsoft/vscode-cpptools/issues/2260), [#2299](https://github.com/Microsoft/vscode-cpptools/issues/2299), [#2317](https://github.com/Microsoft/vscode-cpptools/issues/2317)
|
||||
* Make `Go to Definition` on the definition go to the declaration instead. [#2298](https://github.com/Microsoft/vscode-cpptools/issues/2298)
|
||||
* Add multi-pass environment variable resolution allowing variables defined in terms of other variables. [#2057](https://github.com/Microsoft/vscode-cpptools/issues/2057)
|
||||
* John Patterson (@john-patterson) [PR #2322](https://github.com/Microsoft/vscode-cpptools/pull/2322)
|
||||
* Allow users to use `~` for `${userProfile}` on Windows. [PR #2333](https://github.com/Microsoft/vscode-cpptools/pull/2333)
|
||||
* Add support for compiler flags `-fms-extensions` and `-fno-ms-extensions` on Windows (the default for MinGW-based compilers). [#2363](https://github.com/Microsoft/vscode-cpptools/issues/2363)
|
||||
* Make completion "show more results" (i.e. inaccessible members) when invoked a 2nd time. [#2386](https://github.com/Microsoft/vscode-cpptools/issues/2386)
|
||||
|
||||
### Bug Fixes
|
||||
* Fix attach to process for systems without `bash` by using `sh` instead. [#569](https://github.com/Microsoft/vscode-cpptools/issues/569)
|
||||
* Andy Neff (@andyneff) [PR #2340](https://github.com/Microsoft/vscode-cpptools/pull/2340)
|
||||
* Fix IntelliSense crash after hover or completion with `_Complex` types. [#689](https://github.com/Microsoft/vscode-cpptools/issues/689), [#1112](https://github.com/Microsoft/vscode-cpptools/issues/1112)
|
||||
* Fix `files.exclude` not working to exclude non-workspace folders from symbol parsing. [#1066](https://github.com/Microsoft/vscode-cpptools/issues/1066)
|
||||
* Fix `Switch Header/Source` to give results that match the parent folder name before using just the file name. [#1085](https://github.com/Microsoft/vscode-cpptools/issues/1085)
|
||||
* Fix incorrect IntelliSense errors caused by namespace lookup failure when instantiation template arguments in clang mode. [#1395](https://github.com/Microsoft/vscode-cpptools/issues/1395), [#1559](https://github.com/Microsoft/vscode-cpptools/issues/1559), [#1753](https://github.com/Microsoft/vscode-cpptools/issues/1753), [#2272](https://github.com/Microsoft/vscode-cpptools/issues/2272)
|
||||
* Fix missing parameter help when using { for constructors. [#1667](https://github.com/Microsoft/vscode-cpptools/issues/1667)
|
||||
* Fix Mac framework dependencies not being discovered. [#1913](https://github.com/Microsoft/vscode-cpptools/issues/1913)
|
||||
* Fix `compilerPath` not working with `${workspaceFolder}`. [#1982](https://github.com/Microsoft/vscode-cpptools/issues/1982)
|
||||
* Fix red flame getting stuck after modifying `c_cpp_properties.json`. [#2077](https://github.com/Microsoft/vscode-cpptools/issues/2077)
|
||||
* Don't add empty `windowsSDKVersion` if none exists. [#2300](https://github.com/Microsoft/vscode-cpptools/issues/2300)
|
||||
* Fix IntelliSense crash when the gcc-8 type_traits header is used. [#2323](https://github.com/Microsoft/vscode-cpptools/issues/2323), [#2328](https://github.com/Microsoft/vscode-cpptools/issues/2328)
|
||||
* Limit configuration popups to one at a time. [#2324](https://github.com/Microsoft/vscode-cpptools/issues/2324)
|
||||
* Don't show `includePath` code actions if compile commands or custom configuration providers are used. [#2334](https://github.com/Microsoft/vscode-cpptools/issues/2334)
|
||||
* Fix `C_Cpp.clang_format_path` not accepting environment variables. [#2344](https://github.com/Microsoft/vscode-cpptools/issues/2344)
|
||||
* Fix IntelliSense not working with non-ASCII characters in the WSL install path. [#2351](https://github.com/Microsoft/vscode-cpptools/issues/2351)
|
||||
* Filter out buggy IntelliSense error `"= delete" can only appear on the first declaration of a function`. [#2352](https://github.com/Microsoft/vscode-cpptools/issues/2352)
|
||||
* Fix IntelliSense failing with WSL if gcc is installed bug g++ isn't. [#2360](https://github.com/Microsoft/vscode-cpptools/issues/2360)
|
||||
* Fix WSL paths starting with `/mnt/` failing to get symbols parsed. [#2361](https://github.com/Microsoft/vscode-cpptools/issues/2361)
|
||||
* Fix IntelliSense process crash when hovering over a designated initializer list with an anonymous struct. [#2370](https://github.com/Microsoft/vscode-cpptools/issues/2370)
|
||||
* Stop showing "File: " in completion details for internal compiler defines. [#2387](https://github.com/Microsoft/vscode-cpptools/issues/2387)
|
||||
* Invoke `Edit Configurations...` when the `Configuration Help` button is clicked. [#2408](https://github.com/Microsoft/vscode-cpptools/issues/2408)
|
||||
* Fix provider configuration prompt not showing for newly added workspace folders. [#2415](https://github.com/Microsoft/vscode-cpptools/issues/2415)
|
||||
* Fix to allow SIGINT to be sent using the kill -2 command when using pipeTransport.
|
||||
|
||||
## Version 0.17.7: July 22, 2018
|
||||
* Fix `Go to Definition` for code scoped with an aliased namespace. [#387](https://github.com/Microsoft/vscode-cpptools/issues/387)
|
||||
* Fix incorrect IntelliSense errors with template template-arguments. [#1014](https://github.com/Microsoft/vscode-cpptools/issues/1014)
|
||||
* Fix crash when using designated initializer lists. [#1440](https://github.com/Microsoft/vscode-cpptools/issues/1440)
|
||||
* Add `windowsSdkVersion` to `c_cpp_properties.json`. [#1585](https://github.com/Microsoft/vscode-cpptools/issues/1585)
|
||||
* Add `${vcpkgRoot}` variable. [#1817](https://github.com/Microsoft/vscode-cpptools/issues/1817)
|
||||
* Fix dangling IntelliSense processes. [#2075](https://github.com/Microsoft/vscode-cpptools/issues/2075), [#2169](https://github.com/Microsoft/vscode-cpptools/issues/2169)
|
||||
* Fix incorrect IntelliSense errors when class template argument deduction is used. [#2101](https://github.com/Microsoft/vscode-cpptools/issues/2101)
|
||||
* Skip automatic parsing of source files in Mac system framework paths. [#2156](https://github.com/Microsoft/vscode-cpptools/issues/2156)
|
||||
* Fix `Edit Configurations...` not working after `c_cpp_properties.json` is deleted. [#2214](https://github.com/Microsoft/vscode-cpptools/issues/2214)
|
||||
* Fix indexing of the entire root drive on Windows when no is folder open. [#2216](https://github.com/Microsoft/vscode-cpptools/issues/2216)
|
||||
* Disable the config provider message for headers outside the workspace and when debugging. [#2221](https://github.com/Microsoft/vscode-cpptools/issues/2221)
|
||||
* Add `Change Configuration Provider...` command. [#2224](https://github.com/Microsoft/vscode-cpptools/issues/2224)
|
||||
* Fix out-of-memory crash with `#include` code actions when no folder is open. [#2225](https://github.com/Microsoft/vscode-cpptools/issues/2225)
|
||||
* Fix `intelliSenseMode` with custom config providers on Windows. [#2228](https://github.com/Microsoft/vscode-cpptools/issues/2228)
|
||||
* Fix formatting not working on Windows if the VC++ 2015 redist isn't installed. [#2232](https://github.com/Microsoft/vscode-cpptools/issues/2232)
|
||||
* Fix variables not resolving in `macFrameworkPath`. [#2234](https://github.com/Microsoft/vscode-cpptools/issues/2234)
|
||||
* Fix `Go to Definition` not working for macros followed by `.` or `->`. [#2245](https://github.com/Microsoft/vscode-cpptools/issues/2245)
|
||||
* Fix `#include` autocomplete with Mac framework headers. [#2251](https://github.com/Microsoft/vscode-cpptools/issues/2251)
|
||||
* Fix debugging to support empty arguments for debuggee. [#2258](https://github.com/Microsoft/vscode-cpptools/issues/2258)
|
||||
* Fix `Go to Definition` bug (missing symbols outside the workspace). [#2281](https://github.com/Microsoft/vscode-cpptools/issues/2281)
|
||||
* Fix incorrect hover in enum definitions. [#2286](https://github.com/Microsoft/vscode-cpptools/issues/2286)
|
||||
* Add a setting to silence configuration provider warnings. [#2292](https://github.com/Microsoft/vscode-cpptools/issues/2292)
|
||||
* Fix debugging async Visual C++ causing debugger to hang.
|
||||
* Fix `main` snippet.
|
||||
|
||||
## Version 0.17.6: July 2, 2018
|
||||
* Fix the database icon getting stuck with recursive includes. [#2104](https://github.com/Microsoft/vscode-cpptools/issues/2104)
|
||||
* Fix the red flame appearing late with recursive includes. [#2105](https://github.com/Microsoft/vscode-cpptools/issues/2105)
|
||||
* Fix source files being parsed in system directories. [#2156](https://github.com/Microsoft/vscode-cpptools/issues/2156)
|
||||
* Fix internal document corruption (visible after formatting) when edits are made too soon after activation. [#2162](https://github.com/Microsoft/vscode-cpptools/issues/2162)
|
||||
* Fix a crash when saving with recursive includes. [#2173](https://github.com/Microsoft/vscode-cpptools/issues/2173)
|
||||
* Fix a crash when the `includePath` or `browse.path` is `"**"`. [#2174](https://github.com/Microsoft/vscode-cpptools/issues/2174)
|
||||
* Fix IntelliSense for WSL without g++ installed. [#2178](https://github.com/Microsoft/vscode-cpptools/issues/2178)
|
||||
* Fix random IntelliSense (completion) failures due to edits being delayed. [#2184](https://github.com/Microsoft/vscode-cpptools/issues/2184)
|
||||
* Fix database deletion failure with non-ASCII file paths on Windows. [#2205](https://github.com/Microsoft/vscode-cpptools/issues/2205)
|
||||
* Fix `Go to Definition` results with `var::` and `var->`, and filter out invalid constructor results. [#2207](https://github.com/Microsoft/vscode-cpptools/issues/2207)
|
||||
* Fix a performance bug with recursive includes.
|
||||
* Fixed a CPU usage problem on Mac related to system frameworks parsing.
|
||||
* Keep the IntelliSense process around for 10 seconds after a file is closed in case it's needed again.
|
||||
* Added an API so build system extensions can provide IntelliSense configurations for source files. More details at [npmjs.com](https://www.npmjs.com/package/vscode-cpptools).
|
||||
* Fix automatic argument quoting when debugging with gdb/lldb to include when the argument has a '(' or ')' in it. Also escape existing '"' symbols.
|
||||
* Removed `-` in `ps` call for ProcessPicker and RemoteProcessPicker. [#2183](https://github.com/Microsoft/vscode-cpptools/issues/2183)
|
||||
|
||||
## Version 0.17.5: June 21, 2018
|
||||
* Detect `compile_commands.json` and show prompt to use it. [#1297](https://github.com/Microsoft/vscode-cpptools/issues/1297)
|
||||
* Change inactive regions from gray to translucent. [#1907](https://github.com/Microsoft/vscode-cpptools/issues/1907)
|
||||
@@ -14,9 +389,9 @@
|
||||
* On Windows, `compilerPath` now populates with the guessed `cl.exe` path, and the `MSVC` include path is based on the `cl.exe` path.
|
||||
* Fix files under a non-recursive `browse.path` being removed from the database.
|
||||
* Fix `*` not working in `browse.path` with WSL.
|
||||
* Fix for -break-insert main returning multiple bind points. [#729](https://github.com/Microsoft/MIEngine/pull/729)
|
||||
* Use -- instead of -x for gnome-terminal. [#733](https://github.com/Microsoft/MIEngine/pull/733)
|
||||
* Added `miDebuggerArgs` in order to pass arguments to the program in `miDebuggerPath`. [#720](https://github.com/Microsoft/MIEngine/pull/720)
|
||||
* Fix -break-insert main returning multiple bind points. [PR Microsoft/MIEngine#729](https://github.com/Microsoft/MIEngine/pull/729)
|
||||
* Use -- instead of -x for gnome-terminal. [PR Microsoft/MIEngine#733](https://github.com/Microsoft/MIEngine/pull/733)
|
||||
* Added `miDebuggerArgs` in order to pass arguments to the program in `miDebuggerPath`. [PR Microsoft/MIEngine#720](https://github.com/Microsoft/MIEngine/pull/720)
|
||||
|
||||
## Version 0.17.4: May 31, 2018
|
||||
* Fix infinite loop (caused by deadlock) when using recursive includes. [#2043](https://github.com/Microsoft/vscode-cpptools/issues/2043)
|
||||
@@ -121,9 +496,9 @@
|
||||
* Add `C_Cpp.exclusionPolicy` default to `checkFolders` to avoid expensive `files.exclude` checking on every file.
|
||||
|
||||
## Version 0.14.5: December 18, 2017
|
||||
* Fix for stackwalk `NullReferenceException`. [#1339](https://github.com/Microsoft/vscode-cpptools/issues/1339)
|
||||
* Fix for `-isystem` (or `-I`) not being used in `compile_commands.json` if there's a space after it. [#1343](https://github.com/Microsoft/vscode-cpptools/issues/1343)
|
||||
* Fix for header switching from `.cc` to `.hpp` files (and other cases). [#1341](https://github.com/Microsoft/vscode-cpptools/issues/1341)
|
||||
* Fix stackwalk `NullReferenceException`. [#1339](https://github.com/Microsoft/vscode-cpptools/issues/1339)
|
||||
* Fix `-isystem` (or `-I`) not being used in `compile_commands.json` if there's a space after it. [#1343](https://github.com/Microsoft/vscode-cpptools/issues/1343)
|
||||
* Fix header switching from `.cc` to `.hpp` files (and other cases). [#1341](https://github.com/Microsoft/vscode-cpptools/issues/1341)
|
||||
* Fix reload prompts not appearing in debugging scenarios (after the initial installation). [#1344](https://github.com/Microsoft/vscode-cpptools/issues/1344)
|
||||
* Add a "wait" message when commands are invoked during download/installation. [#1344](https://github.com/Microsoft/vscode-cpptools/issues/1344)
|
||||
* Prevent blank "C/C++ Configuration" from appearing when debugging is started but the language service is not. [#1353](https://github.com/Microsoft/vscode-cpptools/issues/1353)
|
||||
@@ -142,9 +517,9 @@
|
||||
* Improve performance for fetching call stacks with large arguments. [#363](https://github.com/Microsoft/vscode-cpptools/issues/363)
|
||||
|
||||
## Version 0.14.3: November 27, 2017
|
||||
* Fix for disappearing parameter hints tooltip. [#1165](https://github.com/Microsoft/vscode-cpptools/issues/1165)
|
||||
* Fix for parameter hints only showing up after the opening parenthesis. [#902](https://github.com/Microsoft/vscode-cpptools/issues/902), [#819](https://github.com/Microsoft/vscode-cpptools/issues/819)
|
||||
* Fix for customer reported crashes in the TypeScript extension code. [#1240](https://github.com/Microsoft/vscode-cpptools/issues/1240), [#1245](https://github.com/Microsoft/vscode-cpptools/issues/1245)
|
||||
* Fix disappearing parameter hints tooltip. [#1165](https://github.com/Microsoft/vscode-cpptools/issues/1165)
|
||||
* Fix parameter hints only showing up after the opening parenthesis. [#902](https://github.com/Microsoft/vscode-cpptools/issues/902), [#819](https://github.com/Microsoft/vscode-cpptools/issues/819)
|
||||
* Fix customer reported crashes in the TypeScript extension code. [#1240](https://github.com/Microsoft/vscode-cpptools/issues/1240), [#1245](https://github.com/Microsoft/vscode-cpptools/issues/1245)
|
||||
* Fix .browse.VC-#.db files being unnecessarily created when an shm file exists. [#1234](https://github.com/Microsoft/vscode-cpptools/issues/1234)
|
||||
* Fix language service to only activate after a C/C++ file is opened or a C/Cpp command is used (not onDebug).
|
||||
* Fix database resetting if shutdown got blocked by an IntelliSense operation. [#1260](https://github.com/Microsoft/vscode-cpptools/issues/1260)
|
||||
@@ -198,7 +573,7 @@
|
||||
## Version 0.13.0: September 25, 2017
|
||||
* Reference highlighting is now provided by the extension for both IntelliSense engines.
|
||||
* Parameter help is now provided by both IntelliSense engines.
|
||||
* Light bulbs (code actions) for #include errors now suggest potential paths to add to the `includePath` based on a recursive search of the `browse.path`. [#846](https://github.com/Microsoft/vscode-cpptools/issues/846)
|
||||
* Light bulbs (code actions) for `#include` errors now suggest potential paths to add to the `includePath` based on a recursive search of the `browse.path`. [#846](https://github.com/Microsoft/vscode-cpptools/issues/846)
|
||||
* Browse database now removes old symbols when `browse.path` changes. [#262](https://github.com/Microsoft/vscode-cpptools/issues/262)
|
||||
* Add `*` on new lines after a multiline comment with `/**` is started. [#579](https://github.com/Microsoft/vscode-cpptools/issues/579)
|
||||
* Fix `Go to Definition`, completion, and parameter hints for partially scoped members. [#635](https://github.com/Microsoft/vscode-cpptools/issues/635)
|
||||
@@ -212,7 +587,7 @@
|
||||
* Support `${env:VAR}` syntax for environment variables in `c_cpp_properties.json`. [#1000](https://github.com/Microsoft/vscode-cpptools/issues/1000)
|
||||
* Support semicolon delimiters for include paths in `c_cpp_properties.json` to better support environment variables. [#1001](https://github.com/Microsoft/vscode-cpptools/issues/1001)
|
||||
* Add `__LITTLE_ENDIAN__=1` to default defines so that "endian.h" is not needed on Mac projects. [#1005](https://github.com/Microsoft/vscode-cpptools/issues/1005)
|
||||
* Fix for source code files on Windows with incorrect casing. [#984](https://github.com/Microsoft/vscode-cpptools/issues/984)
|
||||
* Fix source code files on Windows with incorrect casing. [#984](https://github.com/Microsoft/vscode-cpptools/issues/984)
|
||||
|
||||
## Version 0.12.3: August 17, 2017
|
||||
* Fix regression for paths containing multibyte characters. [#958](https://github.com/Microsoft/vscode-cpptools/issues/958)
|
||||
@@ -248,7 +623,7 @@
|
||||
* Update Microsoft Visual C++ debugger to Visual Studio 2017 released components.
|
||||
* Fix issue with showing wrong thread. [#550](https://github.com/Microsoft/vscode-cpptools/issues/550)
|
||||
* Fix issue with binaries compiled with /FASTLINK causing debugger to hang. [#484](https://github.com/Microsoft/vscode-cpptools/issues/484)
|
||||
* Fix issue in MinGW/Cygwin debugging where stop debugging causes VS Code to hang. [Microsoft/MIEngine#636](https://github.com/Microsoft/MIEngine/pull/636)
|
||||
* Fix issue in MinGW/Cygwin debugging where stop debugging causes VS Code to hang. [PR Microsoft/MIEngine#636](https://github.com/Microsoft/MIEngine/pull/636)
|
||||
|
||||
## Version 0.12.0: June 26, 2017
|
||||
* The default IntelliSense engine now provides semantic-aware autocomplete suggestions for `.`, `->`, and `::` operators. [#13](https://github.com/Microsoft/vscode-cpptools/issues/13)
|
||||
@@ -265,8 +640,8 @@
|
||||
* Fix `Go to Definition` not working until all `browse.path` files are re-scanned. [#788](https://github.com/Microsoft/vscode-cpptools/issues/788)
|
||||
|
||||
## Version 0.11.4: June 2, 2017
|
||||
* Fix for `System.Xml.Serialization.XmlSerializationReader threw an exception` when debugging on Linux. [#792](https://github.com/Microsoft/vscode-cpptools/issues/792)
|
||||
* Fix for escaping for `${workspaceRoot}` in `launch.json`.
|
||||
* Fix `System.Xml.Serialization.XmlSerializationReader threw an exception` when debugging on Linux. [#792](https://github.com/Microsoft/vscode-cpptools/issues/792)
|
||||
* Fix escaping for `${workspaceRoot}` in `launch.json`.
|
||||
|
||||
## Version 0.11.3: May 31, 2017
|
||||
* Fix `x86_64-pc-linux-gnu` and `x86_64-linux-gnu` paths missing from the default `includePath`.
|
||||
@@ -314,7 +689,7 @@
|
||||
|
||||
## Version 0.10.5: March 21, 2017
|
||||
* Fix a crash that randomly occurred when the size of a document increased. [#430](https://github.com/Microsoft/vscode-cpptools/issues/430)
|
||||
* Fix for browsing not working for Linux/Mac stdlib.h functions. [#578](https://github.com/Microsoft/vscode-cpptools/issues/578)
|
||||
* Fix browsing not working for Linux/Mac stdlib.h functions. [#578](https://github.com/Microsoft/vscode-cpptools/issues/578)
|
||||
* Additional fixes for switch header/source not respecting `files.exclude`. [#485](https://github.com/Microsoft/vscode-cpptools/issues/485)
|
||||
* Made `editor.quickSuggestions` dependent on `C_Cpp.autocomplete`. [#572](https://github.com/Microsoft/vscode-cpptools/issues/572)
|
||||
* We recommend you close and reopen your settings.json file anytime you change the `C_Cpp.autocomplete` setting. [More info here](https://github.com/Microsoft/vscode-cpptools/releases).
|
||||
@@ -394,7 +769,7 @@
|
||||
* Switch between header and source.
|
||||
* Control which files are processed under include path.
|
||||
|
||||
## Version 0.6.1: June 03, 2016
|
||||
## Version 0.6.1: June 3, 2016
|
||||
* Bug fixes.
|
||||
|
||||
## Version 0.6.0: May 24, 2016
|
||||
|
||||
+63
-24
@@ -1,27 +1,66 @@
|
||||
# C/C++ for Visual Studio Code
|
||||
This preview release of the extension adds language support for C/C++ to Visual Studio Code including:
|
||||
* Language service
|
||||
* Code Formatting (clang-format)
|
||||
* Auto-Completion (experimental)
|
||||
* Symbol Searching
|
||||
* Go to Definition/Declaration
|
||||
* Peek Definition/Declaration
|
||||
* Class/Method Navigation
|
||||
* Signature Help
|
||||
* Quick Info (Hover)
|
||||
* Error Squiggles
|
||||
* Debugging
|
||||
* Support for debugging Windows (PDB, Mingw/Cygwin), Linux and OS X applications
|
||||
* Line by line code stepping
|
||||
* Breakpoints (including conditional and function breakpoints)
|
||||
* Variable inspection
|
||||
* Multi-threaded debugging support
|
||||
* Core dump debugging support
|
||||
* Executing GDB or MI commands directly when using 'C++ (GDB/LLDB)' debugging environment
|
||||
* For help configuring the debugger see [Configuring launch.json for C/C++ debugging](https://github.com/Microsoft/vscode-cpptools/blob/master/launch.md)
|
||||
on our [GitHub page](https://github.com/Microsoft/vscode-cpptools).
|
||||
|
||||
You can find more detailed information about C/C++ support for Visual Studio Code at our [GitHub page](https://github.com/Microsoft/vscode-cpptools/tree/master/Documentation) and our [VS Code documentation page](https://code.visualstudio.com/docs/languages/cpp).
|
||||
#### [Repository](https://github.com/microsoft/vscode-cpptools) | [Issues](https://github.com/microsoft/vscode-cpptools/issues) | [Documentation](https://code.visualstudio.com/docs/languages/cpp) | [Code Samples](https://github.com/microsoft/vscode-cpptools/tree/master/Code%20Samples) | [Offline Installers](https://github.com/microsoft/vscode-cpptools/releases)
|
||||
|
||||
## Contact Us
|
||||
If you run into any issues or have suggestions for us, please file [issues and suggestions on GitHub](https://github.com/Microsoft/vscode-cpptools/issues). If you haven’t already provided us feedback, please take this [quick survey](https://www.research.net/r/VBVV6C6) to help shape this extension for your needs.
|
||||
[](https://aka.ms/vsls)
|
||||
|
||||
This preview release of the C/C++ extension adds language support for C/C++ to Visual Studio Code, including features such as IntelliSense and debugging.
|
||||
|
||||
## Overview and getting started
|
||||
* [C/C++ extension overview](https://code.visualstudio.com/docs/languages/cpp)
|
||||
* [Get Started with C++ and Windows Subsystem for Linux (WSL)](https://code.visualstudio.com/docs/cpp/config-wsl)
|
||||
* [Get Started with C++ and Mingw-w64](https://code.visualstudio.com/docs/cpp/config-mingw)
|
||||
* [Get Started with C++ and Clang/LLVM on macOS](https://code.visualstudio.com/docs/cpp/config-clang-mac)
|
||||
* [Get Started with C++ and Microsoft C++ compiler (MSVC)](https://code.visualstudio.com/docs/cpp/config-msvc)
|
||||
|
||||
## Quick links
|
||||
* [Editing features (IntelliSense)](https://code.visualstudio.com/docs/cpp/cpp-ide)
|
||||
* [IntelliSense configuration](https://code.visualstudio.com/docs/cpp/customize-default-settings-cpp)
|
||||
* [Enhanced colorization](https://code.visualstudio.com/docs/cpp/colorization-cpp)
|
||||
* [Debugging](https://code.visualstudio.com/docs/cpp/cpp-debug)
|
||||
* [Debug configuration](https://code.visualstudio.com/docs/cpp/launch-json-reference)
|
||||
* [Enable logging for IntelliSense or debugging](https://code.visualstudio.com/docs/cpp/enable-logging-cpp)
|
||||
|
||||
## Questions and feedback
|
||||
|
||||
**[FAQs](https://code.visualstudio.com/docs/cpp/faq-cpp)**
|
||||
<br>
|
||||
Check out the FAQs before filing a question.
|
||||
<br>
|
||||
|
||||
**[Provide feedback](https://github.com/microsoft/vscode-cpptools/issues/new/choose)**
|
||||
<br>
|
||||
File questions, issues, or feature requests for the extension.
|
||||
<br>
|
||||
|
||||
**[Known issues](https://github.com/Microsoft/vscode-cpptools/issues)**
|
||||
<br>
|
||||
If someone has already filed an issue that encompasses your feedback, please leave a 👍 or 👎 reaction on the issue to upvote or downvote it to help us prioritize the issue.
|
||||
<br>
|
||||
|
||||
**[Quick survey](https://www.research.net/r/VBVV6C6)**
|
||||
<br>
|
||||
Let us know what you think of the extension by taking the quick survey.
|
||||
|
||||
## Offline installation
|
||||
|
||||
The extension has platform-specific binary dependencies, therefore installation via the Marketplace requires an Internet connection in order to download additional dependencies. If you are working on a computer that does not have access to the Internet or is behind a strict firewall, you may need to use our platform-specific packages and install them by running VS Code's `"Install from VSIX..."` command. These "offline' packages are available at: https://github.com/Microsoft/vscode-cpptools/releases.
|
||||
|
||||
Package | Platform
|
||||
:--- | :---
|
||||
`cpptools-linux.vsix` | Linux 64-bit
|
||||
`cpptools-linux32.vsix` | Linux 32-bit
|
||||
`cpptools-osx.vsix` | macOS
|
||||
`cpptools-win32.vsix` | Windows 64-bit & 32-bit
|
||||
|
||||
## Contribution
|
||||
|
||||
Contributions are always welcome. Please see our [contributing guide](CONTRIBUTING.md) for more details.
|
||||
|
||||
## Microsoft Open Source Code of Conduct
|
||||
|
||||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact opencode@microsoft.com with any additional questions or comments.
|
||||
|
||||
## Data and telemetry
|
||||
|
||||
This extension collects usage data and sends it to Microsoft to help improve our products and services. Collection of telemetry is controlled via the same setting provided by Visual Studio Code: `"telemetry.enableTelemetry"`. Read our [privacy statement](https://privacy.microsoft.com/en-us/privacystatement) to learn more.
|
||||
@@ -1,261 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<STYLE type="text/css">
|
||||
body {
|
||||
padding: 10px 20px;
|
||||
line-height: 22px
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
max-height: 100%
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
a:focus,
|
||||
input:focus,
|
||||
select:focus,
|
||||
textarea:focus {
|
||||
outline: 1px solid -webkit-focus-ring-color;
|
||||
outline-offset: -1px
|
||||
}
|
||||
|
||||
hr {
|
||||
border: 0;
|
||||
height: 2px;
|
||||
border-bottom: 2px solid
|
||||
}
|
||||
|
||||
h1 {
|
||||
padding-bottom: .3em;
|
||||
line-height: 1.2;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: solid
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3 {
|
||||
font-weight: 400
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse
|
||||
}
|
||||
|
||||
table > thead > tr > th {
|
||||
text-align: left
|
||||
}
|
||||
|
||||
table > thead > tr > th,
|
||||
table > thead > tr > td,
|
||||
table > tbody > tr > th,
|
||||
table > tbody > tr > td {
|
||||
padding: 5px 10px
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin: 0 7px 0 5px;
|
||||
padding: 0 16px 0 10px;
|
||||
border-left: 5px solid
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: Menlo, Monaco, Consolas, "Droid Sans Mono", "Courier New", monospace, "Droid Sans Fallback";
|
||||
font-size: 14px;
|
||||
line-height: 19px
|
||||
}
|
||||
|
||||
.mac code {
|
||||
font-size: 12px;
|
||||
line-height: 18px
|
||||
}
|
||||
|
||||
code > div {
|
||||
padding: 16px;
|
||||
border-radius: 3px;
|
||||
overflow: auto
|
||||
}
|
||||
|
||||
.monaco-tokenized-source {
|
||||
white-space: pre
|
||||
}
|
||||
|
||||
/** Theming */
|
||||
|
||||
.vscode-light {
|
||||
color: #1e1e1e
|
||||
}
|
||||
|
||||
.vscode-dark {
|
||||
color: #ddd
|
||||
}
|
||||
|
||||
.vscode-high-contrast {
|
||||
color: #fff
|
||||
}
|
||||
|
||||
.vscode-light code {
|
||||
color: #a31515
|
||||
}
|
||||
|
||||
.vscode-dark code {
|
||||
color: #d7ba7d
|
||||
}
|
||||
|
||||
.vscode-light code > div {
|
||||
background-color: rgba(220, 220, 220, .4)
|
||||
}
|
||||
|
||||
.vscode-dark code > div {
|
||||
background-color: rgba(10, 10, 10, .4)
|
||||
}
|
||||
|
||||
.vscode-high-contrast code > div {
|
||||
background-color: #000
|
||||
}
|
||||
|
||||
.vscode-high-contrast h1 {
|
||||
border-color: #000
|
||||
}
|
||||
|
||||
.vscode-light table > thead > tr > th {
|
||||
border-color: rgba(0, 0, 0, .69)
|
||||
}
|
||||
|
||||
.vscode-dark table > thead > tr > th {
|
||||
border-color: rgba(255, 255, 255, .69)
|
||||
}
|
||||
|
||||
.vscode-light h1,
|
||||
.vscode-light hr,
|
||||
.vscode-light table > tbody > tr + tr > td {
|
||||
border-color: rgba(0, 0, 0, .18)
|
||||
}
|
||||
|
||||
.vscode-dark h1,
|
||||
.vscode-dark hr,
|
||||
.vscode-dark table > tbody > tr + tr > td {
|
||||
border-color: rgba(255, 255, 255, 0.18)
|
||||
}
|
||||
|
||||
.vscode-light blockquote,
|
||||
.vscode-dark blockquote {
|
||||
background: rgba(127, 127, 127, .1);
|
||||
border-color: rgba(0, 122, 204, .5)
|
||||
}
|
||||
|
||||
.vscode-high-contrast blockquote {
|
||||
background: transparent;
|
||||
border-color: #fff
|
||||
}
|
||||
|
||||
.main-content {
|
||||
width: 65%;
|
||||
vertical-align: top
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
vertical-align: top
|
||||
}
|
||||
|
||||
.footer {
|
||||
padding: 25px;
|
||||
text-align: center
|
||||
}
|
||||
|
||||
.vscode-light table > tbody > tr > td.sidebar {
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
border-radius: 10px
|
||||
}
|
||||
|
||||
.vscode-dark table > tbody > tr > td.sidebar {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 10px
|
||||
}
|
||||
|
||||
.vscode-light a {
|
||||
color: #4080D0
|
||||
}
|
||||
|
||||
.vscode-dark a {
|
||||
color: #a2c1e8
|
||||
}
|
||||
</STYLE>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div>
|
||||
<div>
|
||||
<h1>Microsoft C/C++ Extension for VS Code</h1>
|
||||
</div>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="main-content">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div>
|
||||
<h2 class="caption">June 2018 Update</h2>
|
||||
<div>Thank you for installing the C/C++ extension. In the June update, we focused on workspace configuration improvements.<br/>
|
||||
<br/>
|
||||
We dramatically improved the performance of recursive includes (e.g. using <code>${workspaceFolder}/**</code> in your <code>includePath</code>), we will prompt you to
|
||||
use compile_commands.json if it is found in your workspace, and we made the <code>browse.path</code> setting optional in the case that it is identical to your <code>includePath</code>.<br/>
|
||||
<br/>
|
||||
Additional features and bug fixes are detailed in the <a href="https://github.com/Microsoft/vscode-cpptools/releases">full release notes</a>.</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="sidebar">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div>
|
||||
<h3 class="caption">Getting Started</h3>
|
||||
<div><a href="https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/Getting%20started%20with%20IntelliSense%20configuration.md">Configuring IntelliSense</a></div>
|
||||
<div><a href="https://github.com/Microsoft/vscode-cpptools/blob/master/launch.md">Configuring Debugging</a></div>
|
||||
<div><a href="https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/MinGW.md">IntelliSense for MinGW projects</a></div>
|
||||
<div><a href="https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/Windows%20Subsystem%20for%20Linux.md">IntelliSense for Windows Subsystem for Linux projects</a></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div>
|
||||
<h3 class="caption">Blog Posts</h3>
|
||||
<div><a href="https://blogs.msdn.microsoft.com/vcblog/2018/05/08/visual-studio-code-cc-extension-may-2018-update-intellisense-configuration-just-got-so-much-easier/">May 2018 Update</a></div>
|
||||
<div><a href="https://blogs.msdn.microsoft.com/vcblog/2018/03/29/visual-studio-code-cc-extension-march-2018-update/">March 2018 Update</a></div>
|
||||
<div><a href="https://blogs.msdn.microsoft.com/vcblog/2018/02/20/visual-studio-code-cc-extension-feb-2018-update/">February 2018 Update</a></div>
|
||||
<div><a href="https://blogs.msdn.microsoft.com/vcblog/2016/03/31/cc-extension-for-visual-studio-code/">C/C++ Extension anouncement</a></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="footer">
|
||||
<div>
|
||||
Having trouble with the extension? -
|
||||
<a href="https://github.com/Microsoft/vscode-cpptools/tree/master/Documentation">Browse the documentation</a> -
|
||||
<a href="https://www.github.com/Microsoft/vscode-cpptools/issues">Report an issue</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+3985
-1423
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M13.451 5.609l-.579-.939-1.068.812-.076.094c-.335.415-.927 1.341-1.124 2.876l-.021.165.033.163.071.345c0 1.654-1.346 3-3 3-.795 0-1.545-.311-2.107-.868-.563-.567-.873-1.317-.873-2.111 0-1.431 1.007-2.632 2.351-2.929v2.926s2.528-2.087 2.984-2.461h.012l3.061-2.582-4.919-4.1h-1.137v2.404c-3.429.318-6.121 3.211-6.121 6.721 0 1.809.707 3.508 1.986 4.782 1.277 1.282 2.976 1.988 4.784 1.988 3.722 0 6.75-3.028 6.75-6.75 0-1.245-.349-2.468-1.007-3.536z" fill="#F6F6F6"/><path d="M12.6 6.134l-.094.071c-.269.333-.746 1.096-.91 2.375.057.277.092.495.092.545 0 2.206-1.794 4-4 4-1.098 0-2.093-.445-2.817-1.164-.718-.724-1.163-1.718-1.163-2.815 0-2.206 1.794-4 4-4l.351.025v1.85s1.626-1.342 1.631-1.339l1.869-1.577-3.5-2.917v2.218l-.371-.03c-3.176 0-5.75 2.574-5.75 5.75 0 1.593.648 3.034 1.695 4.076 1.042 1.046 2.482 1.694 4.076 1.694 3.176 0 5.75-2.574 5.75-5.75-.001-1.106-.318-2.135-.859-3.012z" fill="#424242"/></svg>
|
||||
|
After Width: | Height: | Size: 986 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M13.451 5.609l-.579-.939-1.068.812-.076.094c-.335.415-.927 1.341-1.124 2.876l-.021.165.033.163.071.345c0 1.654-1.346 3-3 3-.795 0-1.545-.311-2.107-.868-.563-.567-.873-1.317-.873-2.111 0-1.431 1.007-2.632 2.351-2.929v2.926s2.528-2.087 2.984-2.461h.012l3.061-2.582-4.919-4.1h-1.137v2.404c-3.429.318-6.121 3.211-6.121 6.721 0 1.809.707 3.508 1.986 4.782 1.277 1.282 2.976 1.988 4.784 1.988 3.722 0 6.75-3.028 6.75-6.75 0-1.245-.349-2.468-1.007-3.536z" fill="#2D2D30"/><path d="M12.6 6.134l-.094.071c-.269.333-.746 1.096-.91 2.375.057.277.092.495.092.545 0 2.206-1.794 4-4 4-1.098 0-2.093-.445-2.817-1.164-.718-.724-1.163-1.718-1.163-2.815 0-2.206 1.794-4 4-4l.351.025v1.85s1.626-1.342 1.631-1.339l1.869-1.577-3.5-2.917v2.218l-.371-.03c-3.176 0-5.75 2.574-5.75 5.75 0 1.593.648 3.034 1.695 4.076 1.042 1.046 2.482 1.694 4.076 1.694 3.176 0 5.75-2.574 5.75-5.75-.001-1.106-.318-2.135-.859-3.012z" fill="#C5C5C5"/></svg>
|
||||
|
After Width: | Height: | Size: 986 B |
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"defaults": [
|
||||
"--pack_alignment",
|
||||
"8"
|
||||
],
|
||||
"defaults_op" : "merge"
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"defaults": [
|
||||
"-D_MSC_EXTENSIONS",
|
||||
"--microsoft",
|
||||
"--microsoft_bugs",
|
||||
"--microsoft_version",
|
||||
"1923",
|
||||
"--pack_alignment",
|
||||
"8",
|
||||
"-D_MSC_VER=1923",
|
||||
"-D_MSC_FULL_VER=192327820",
|
||||
"-D_MSC_BUILD=0",
|
||||
"-D_M_IX86=600",
|
||||
"-D_M_IX86_FP=2"
|
||||
],
|
||||
"defaults_op" : "merge"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"defaults": [
|
||||
"--pack_alignment",
|
||||
"8"
|
||||
],
|
||||
"defaults_op" : "merge"
|
||||
}
|
||||
@@ -4,11 +4,11 @@
|
||||
"--microsoft",
|
||||
"--microsoft_bugs",
|
||||
"--microsoft_version",
|
||||
"1914",
|
||||
"1923",
|
||||
"--pack_alignment",
|
||||
"8",
|
||||
"-D_MSC_VER=1914",
|
||||
"-D_MSC_FULL_VER=191426428",
|
||||
"-D_MSC_VER=1923",
|
||||
"-D_MSC_FULL_VER=192327820",
|
||||
"-D_MSC_BUILD=0",
|
||||
"-D_M_IX86=600",
|
||||
"-D_M_IX86_FP=2"
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"defaults": [
|
||||
"--pack_alignment",
|
||||
"8"
|
||||
],
|
||||
"defaults_op" : "merge"
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"defaults": [
|
||||
"-D_MSC_EXTENSIONS",
|
||||
"--microsoft",
|
||||
"--microsoft_bugs",
|
||||
"--microsoft_version",
|
||||
"1923",
|
||||
"--pack_alignment",
|
||||
"8",
|
||||
"-D_MSC_VER=1923",
|
||||
"-D_MSC_FULL_VER=192327820",
|
||||
"-D_MSC_BUILD=0",
|
||||
"-D_M_IX86=600",
|
||||
"-D_M_IX86_FP=2"
|
||||
],
|
||||
"defaults_op" : "merge"
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"defaults": [
|
||||
"--clang",
|
||||
"--pack_alignment",
|
||||
"8"
|
||||
],
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
"--microsoft",
|
||||
"--microsoft_bugs",
|
||||
"--microsoft_version",
|
||||
"1914",
|
||||
"1923",
|
||||
"--pack_alignment",
|
||||
"8",
|
||||
"-D_CPPUNWIND=1",
|
||||
"-D_MSC_VER=1914",
|
||||
"-D_MSC_FULL_VER=191426428",
|
||||
"-D_MSC_VER=1923",
|
||||
"-D_MSC_FULL_VER=192327820",
|
||||
"-D_MSC_BUILD=0",
|
||||
"-D_M_X64=100",
|
||||
"-D_AMD64=100"
|
||||
"-D_M_AMD64=100"
|
||||
],
|
||||
"defaults_op" : "merge"
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"defaults": [
|
||||
"--clang",
|
||||
"--pack_alignment",
|
||||
"8"
|
||||
],
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
"--microsoft",
|
||||
"--microsoft_bugs",
|
||||
"--microsoft_version",
|
||||
"1914",
|
||||
"1923",
|
||||
"--pack_alignment",
|
||||
"8",
|
||||
"-D_CPPUNWIND=1",
|
||||
"-D_MSC_VER=1914",
|
||||
"-D_MSC_FULL_VER=191426428",
|
||||
"-D_MSC_VER=1923",
|
||||
"-D_MSC_FULL_VER=192327820",
|
||||
"-D_MSC_BUILD=0",
|
||||
"-D_M_X64=100",
|
||||
"-D_AMD64=100"
|
||||
"-D_M_AMD64=100"
|
||||
],
|
||||
"defaults_op" : "merge"
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"defaults": [
|
||||
"--clang",
|
||||
"--pack_alignment",
|
||||
"8"
|
||||
],
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
"--microsoft",
|
||||
"--microsoft_bugs",
|
||||
"--microsoft_version",
|
||||
"1914",
|
||||
"1923",
|
||||
"--pack_alignment",
|
||||
"8",
|
||||
"-D_CPPUNWIND=1",
|
||||
"-D_MSC_VER=1914",
|
||||
"-D_MSC_FULL_VER=191426428",
|
||||
"-D_MSC_VER=1923",
|
||||
"-D_MSC_FULL_VER=192327820",
|
||||
"-D_MSC_BUILD=0",
|
||||
"-D_M_X64=100",
|
||||
"-D_AMD64=100"
|
||||
"-D_M_AMD64=100"
|
||||
],
|
||||
"defaults_op" : "merge"
|
||||
}
|
||||
@@ -15,9 +15,16 @@
|
||||
"type": "string"
|
||||
},
|
||||
"compilerPath": {
|
||||
"description": "Full path of the compiler being used, e.g. /usr/bin/gcc, to enable more accurate IntelliSense. Args can be added to modify the includes/defines used, e.g. -nostdinc++, -m32, etc., but paths with spaces must be surrounded with \\\" if args are used.",
|
||||
"description": "Full path of the compiler being used, e.g. /usr/bin/gcc, to enable more accurate IntelliSense.",
|
||||
"type": "string"
|
||||
},
|
||||
"compilerArgs": {
|
||||
"description": "Compiler arguments to modify the includes or defines used, e.g. -nostdinc++, -m32, etc.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"cStandard": {
|
||||
"description": "Version of the C language standard to use for IntelliSense.",
|
||||
"type": "string",
|
||||
@@ -37,6 +44,7 @@
|
||||
"c++11",
|
||||
"c++14",
|
||||
"c++17",
|
||||
"c++20",
|
||||
"${default}"
|
||||
]
|
||||
},
|
||||
@@ -58,6 +66,11 @@
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"windowsSdkVersion": {
|
||||
"description": "Version of the Windows SDK include path to use on Windows, e.g. '10.0.17134.0'.",
|
||||
"type": "string",
|
||||
"pattern": "^\\d{2}\\.\\d{1}\\.\\d{5}\\.\\d{1}$|^8\\.1$"
|
||||
},
|
||||
"defines": {
|
||||
"description": "A list of preprocessor definitions for the IntelliSense engine to use while parsing files. Optionally, use = to set a value, e.g. VERSION=1.",
|
||||
"type": "array",
|
||||
@@ -66,11 +79,15 @@
|
||||
}
|
||||
},
|
||||
"intelliSenseMode": {
|
||||
"description": "If set, it overrides the default mode used by the IntelliSense engine. Windows defaults to msvc-x64 and Linux/Mac default to clang-x64.",
|
||||
"description": "The IntelliSense mode to use that maps to an architecture-specific variant of MSVC, gcc, or Clang. If not set or if set to ${default}, the extension will choose the default for that platform. Windows defaults to msvc-x64, Linux defaults to gcc-x64, and macOS defaults to clang-x64.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"msvc-x64",
|
||||
"gcc-x64",
|
||||
"clang-x64",
|
||||
"msvc-x86",
|
||||
"gcc-x86",
|
||||
"clang-x86",
|
||||
"${default}"
|
||||
]
|
||||
},
|
||||
@@ -81,6 +98,10 @@
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"configurationProvider": {
|
||||
"description": "The id of a VS Code extension that can provide IntelliSense configuration information for source files.",
|
||||
"type": "string"
|
||||
},
|
||||
"browse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -102,16 +123,18 @@
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"env": {
|
||||
"type": "object",
|
||||
"description": "Custom variables that can be reused anywhere in this file using the ${variable} or ${env:variable} syntax.",
|
||||
"patternProperties": {
|
||||
"(?!^workspaceFolder$)(?!^workspaceRoot$)(?!^default$)(^.+$)": {
|
||||
"(?!^workspaceFolder$)(?!^workspaceRoot$)(?!^workspaceFolderBasename$)(?!^default$)(^.+$)": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
@@ -130,6 +153,11 @@
|
||||
"version": {
|
||||
"type": "integer",
|
||||
"description": "Version of the configuration file. This property is managed by the extension. Please do not change it."
|
||||
},
|
||||
"enableConfigurationSquiggles": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "Controls whether the extension will report errors detected in c_cpp_properties.json."
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
@@ -141,10 +169,14 @@
|
||||
},
|
||||
"version": {
|
||||
"$ref": "#/definitions/version"
|
||||
},
|
||||
"enableConfigurationSquiggles": {
|
||||
"$ref": "#/definitions/enableConfigurationSquiggles"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"configurations",
|
||||
"version"
|
||||
]
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
|
||||
+2
-2574
File diff suppressed because it is too large
Load Diff
@@ -1,140 +0,0 @@
|
||||
{
|
||||
"class": {
|
||||
"prefix": "class",
|
||||
"body": "\nclass ${1:${TM_FILENAME_BASE}}\n{\nprivate:\n\t${2:/* data */}\npublic:\n\t${1}(${3:/* args */});\n\t~${1}();\n};\n\n${1}::${1}(${3})\n{\n}\n\n${1}::~${1}()\n{\n}\n",
|
||||
"description": "Code snippet for class",
|
||||
"scope": "source.c++, source.objc++"
|
||||
},
|
||||
"classi": {
|
||||
"prefix": "classi",
|
||||
"body": "\nclass ${1:${TM_FILENAME_BASE}}\n{\nprivate:\n\t${2:/* data */}\npublic:\n\t${1}(${3:/* args */}) { $0}\n\t~${1}() { }\n};",
|
||||
"description": "Code snippet for class with inlined constructor/destructor",
|
||||
"scope": "source.c++, source.objc++"
|
||||
},
|
||||
"classt": {
|
||||
"prefix": "classt",
|
||||
"body": "\ntemplate<typename T>\nclass ${1:${TM_FILENAME_BASE}}\n{\nprivate:\n\tT ${2:/* data */}\npublic:\n\t${1}(T ${3:/* args */});\n};\n",
|
||||
"description": "Code snippet for class template",
|
||||
"scope": "source.c++, source.objc++"
|
||||
},
|
||||
"struct": {
|
||||
"prefix": "struct",
|
||||
"body": "\nstruct ${1:${TM_FILENAME_BASE}}\n{\n\t${0:/* data */}\n};\n",
|
||||
"description": "Code snippet for struct",
|
||||
"scope": "source.c, source.objc, source.c++, source.objc++"
|
||||
},
|
||||
"union": {
|
||||
"prefix": "union",
|
||||
"body": "\nunion ${1:${TM_FILENAME_BASE}}\n{\n\t${0:/* data */}\n};\n",
|
||||
"description": "Code snippet for union",
|
||||
"scope": "source.c, source.objc, source.c++, source.objc++"
|
||||
},
|
||||
"if": {
|
||||
"prefix": "if",
|
||||
"body": "\nif (${1:/* condition */}) {\n\t${0:/* code */}\n}\n",
|
||||
"description": "Code snippet for if()",
|
||||
"scope": "source.c, source.objc, source.c++, source.objc++"
|
||||
},
|
||||
"ifel": {
|
||||
"prefix": "ifel",
|
||||
"body": "\nif (${1:/* condition */}) {\n\t${2:/* code */}\n}\nelse {\n\t${0:/* code */}\n}\n",
|
||||
"description": "Code snippet for if() else",
|
||||
"scope": "source.c, source.objc, source.c++, source.objc++"
|
||||
},
|
||||
"ifelif": {
|
||||
"prefix": "ifelif",
|
||||
"body": "\nif (${1:/* condition */}) {\n\t${2:/* code */}\n}\nelse if(${3:/* condition */}) {\n\t${4:/* code */}\n}\nelse {\n\t${0:/* code */}\n}\n",
|
||||
"description": "Code snippet for if() else if() else",
|
||||
"scope": "source.c, source.objc, source.c++, source.objc++"
|
||||
},
|
||||
"else": {
|
||||
"prefix": "else",
|
||||
"body": "\nelse\n{\n\t${0:/* code */}\n}\n",
|
||||
"description": "Code snippet for else",
|
||||
"scope": "source.c, source.objc, source.c++, source.objc++"
|
||||
},
|
||||
"elif": {
|
||||
"prefix": "elif",
|
||||
"body": "\nelse if (${1:/* condition */})\n{\n\t${0:/* code */}\n}\n",
|
||||
"description": "Code snippet for else if ()",
|
||||
"scope": "source.c, source.objc, source.c++, source.objc++"
|
||||
},
|
||||
"switch": {
|
||||
"prefix": "switch",
|
||||
"body": "\nswitch (${1:expression})\n{\n\tcase ${2:/* constant-expression */}:\n\t\t${3:/* code */}\n\t\tbreak;\n\n\tdefault:\n\t\tbreak;\n}",
|
||||
"description": "Code snippet for switch",
|
||||
"scope": "source.c, source.objc, source.c++, source.objc++"
|
||||
},
|
||||
"main": {
|
||||
"prefix": "main",
|
||||
"body": "\nint main(int argc, char const *argv[])\n{\n\t${1:/* code */}\n\treturn 0;\n}\n",
|
||||
"description": "Code snippet for main()",
|
||||
"scope": "source.c, source.objc, source.c++, source.objc++"
|
||||
},
|
||||
"do": {
|
||||
"prefix": "do_",
|
||||
"body": "\ndo\n{\n\t${0:/* code */}\n} while (${1:/* condition */});\n",
|
||||
"description": "Code snippet for do while loop",
|
||||
"scope": "source.c, source.objc, source.c++, source.objc++"
|
||||
},
|
||||
"for": {
|
||||
"prefix": "for",
|
||||
"body": "\nfor(${1:size_t} ${2:i} = 0; $2 < ${3:count}; ${4:$2++})\n{\n\t${0:/* code */}\n}\n",
|
||||
"description": "Code snippet for for loop",
|
||||
"scope": "source.c, source.objc, source.c++, source.objc++"
|
||||
},
|
||||
"forr": {
|
||||
"prefix": "forr",
|
||||
"body": "\nfor(int ${1:i} = ${2:length} - 1; $1 >= 0; ${3:$1--})\n{\n\t${0:/* code */}\n}\n",
|
||||
"description": "Code snippet for reverse for loop",
|
||||
"scope": "source.c, source.objc, source.c++, source.objc++"
|
||||
},
|
||||
"foreach": {
|
||||
"prefix": "foreach",
|
||||
"body": "\nfor(${1:object} = ${2:var} in ${3:collection})\n{\n\t${0:/* code */}\n}\n",
|
||||
"description": "Code snippet for foreach loop",
|
||||
"scope": "source.c, source.objc, source.c++, source.objc++"
|
||||
},
|
||||
"forrange": {
|
||||
"prefix": "forrange",
|
||||
"body": "\nfor(auto&& ${1:i} : ${2:v})\n{\n\t$0\n}\n",
|
||||
"description": "Code snippet for range-based forloop",
|
||||
"scope": "source.c, source.objc, source.c++, source.objc++"
|
||||
},
|
||||
"while": {
|
||||
"prefix": "while",
|
||||
"body": "\nwhile(${1:/* condition */}){\n\t${2:/* code */}\n}\n",
|
||||
"description": "Code snippet for while loop",
|
||||
"scope": "source.c, source.objc, source.c++, source.objc++"
|
||||
},
|
||||
"ifd": {
|
||||
"prefix": "ifnd",
|
||||
"body": "\n#if defined($1)\n\n${0}\n\n#endif // $1\n",
|
||||
"description": "Code snippet for if defined()",
|
||||
"scope": "source.c, source.objc, source.c++, source.objc++"
|
||||
},
|
||||
"ifnd": {
|
||||
"prefix": "ifnd",
|
||||
"body": "\n#if !defined($1)\n#define ${1:MACRO}\n\n${0}\n\n#endif // $1\n",
|
||||
"description": "Code snippet for if !defined()",
|
||||
"scope": "source.c, source.objc, source.c++, source.objc++"
|
||||
},
|
||||
"mitl": {
|
||||
"prefix": "mitl",
|
||||
"body": "\n// The MIT License (MIT)\n\n// Copyright (c) ${1:YEAR} ${2:NAME}\n\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the \"Software\"),\n// to deal in the Software without restriction, including without limitation\n// the rights to use, copy, modify, merge, publish, distribute, sublicense,\n// and/or sell copies of the Software, and to permit persons to whom the\n// Software is furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n// DEALINGS IN THE SOFTWARE.\n\n${0:/* code */}\n",
|
||||
"description": "Code snippet for MIT License",
|
||||
"scope": ""
|
||||
},
|
||||
"namesp": {
|
||||
"prefix": "namesp",
|
||||
"body": "\nnamespace ${1:name}\n{\n\t$0\n} // $1\n",
|
||||
"description": "Code snippet for namespace",
|
||||
"scope": "source.c++, source.objc++"
|
||||
},
|
||||
"try": {
|
||||
"prefix": "try",
|
||||
"body": "\ntry\n{\n\t${1:/* code */}\n}\ncatch(${2:const std::exception& e})\n{\n\t${0:std::cerr << e.what() << '\\n';}\n}\n",
|
||||
"description": "Code snippet for try catch block",
|
||||
"scope": "source.c++, source.objc++, source.c++11"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
{
|
||||
"intelliSenseEngine_default_percentage": 100,
|
||||
"defaultIntelliSenseEngine": 100,
|
||||
"recursiveIncludes": 100
|
||||
"recursiveIncludes": 100,
|
||||
"gotoDefIntelliSense": 100,
|
||||
"enhancedColorization": 100
|
||||
}
|
||||
+22
-38
@@ -12,47 +12,26 @@ const mocha = require('gulp-mocha');
|
||||
const fs = require('fs');
|
||||
const optionsSchemaGenerator = require('./out/tools/GenerateOptionsSchema');
|
||||
|
||||
gulp.task('allTests', () => {
|
||||
gulp.start('unitTests');
|
||||
gulp.start('integrationTests');
|
||||
});
|
||||
|
||||
gulp.task('unitTests', () => {
|
||||
gulp.src('./out/test/unitTests', {read: false}).pipe(
|
||||
mocha({
|
||||
ui: "tdd"
|
||||
})
|
||||
).once('error', err => {
|
||||
process.exit(1);
|
||||
})
|
||||
.once('end', () => {
|
||||
process.exit();
|
||||
})
|
||||
});
|
||||
|
||||
gulp.task('integrationTests', () => {
|
||||
gulp.task('unitTests', (done) => {
|
||||
env.set({
|
||||
CODE_TESTS_PATH: "./out/test/integrationTests",
|
||||
CODE_TESTS_WORKSPACE: "./test/integrationTests/testAssets/SimpleCppProject"
|
||||
}
|
||||
);
|
||||
gulp.src('./test/runVsCodeTestsWithAbsolutePaths.js', {read: false}).pipe(
|
||||
mocha({
|
||||
ui: "tdd",
|
||||
delay: true
|
||||
CODE_TESTS_PATH: "./out/test/unitTests",
|
||||
});
|
||||
|
||||
return gulp.src('./test/runVsCodeTestsWithAbsolutePaths.js', {read: false})
|
||||
.pipe(mocha({ ui: "tdd" }))
|
||||
.once('error', err => {
|
||||
done();
|
||||
process.exit(1);
|
||||
})
|
||||
).once('error', err => {
|
||||
process.exit(1);
|
||||
})
|
||||
.once('end', () => {
|
||||
process.exit();
|
||||
})
|
||||
.once('end', () => {
|
||||
done();
|
||||
process.exit();
|
||||
});
|
||||
});
|
||||
|
||||
/// Misc Tasks
|
||||
const allTypeScript = [
|
||||
'src/**/*.ts',
|
||||
'tools/**/*.ts',
|
||||
'!**/*.d.ts',
|
||||
'!**/typings**'
|
||||
];
|
||||
@@ -67,7 +46,7 @@ const lintReporter = (output, file, options) => {
|
||||
};
|
||||
|
||||
gulp.task('tslint', () => {
|
||||
gulp.src(allTypeScript)
|
||||
return gulp.src(allTypeScript)
|
||||
.pipe(tslint({
|
||||
program: require('tslint').Linter.createProgram("./tsconfig.json"),
|
||||
configuration: "./tslint.json"
|
||||
@@ -78,14 +57,19 @@ gulp.task('tslint', () => {
|
||||
}))
|
||||
});
|
||||
|
||||
gulp.task('pr-check', () => {
|
||||
gulp.task('pr-check', (done) => {
|
||||
const packageJson = JSON.parse(fs.readFileSync('./package.json').toString());
|
||||
if (packageJson.activationEvents.length !== 1 && packageJson.activationEvents[0] !== '*') {
|
||||
if (packageJson.activationEvents.length !== 1 && packageJson.activationEvents[0] !== '*') {
|
||||
console.log('Please make sure to not check in package.json that has been rewritten by the extension activation. If you intended to have changes in package.json, please only check-in your changes. If you did not, please run `git checkout -- package.json`.');
|
||||
done();
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
gulp.task('generateOptionsSchema', () => {
|
||||
gulp.task('generateOptionsSchema', (done) => {
|
||||
optionsSchemaGenerator.generateOptionsSchema();
|
||||
|
||||
done();
|
||||
});
|
||||
@@ -0,0 +1,51 @@
|
||||
parameters:
|
||||
name: ''
|
||||
pool: ''
|
||||
|
||||
jobs:
|
||||
- job: Windows
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
displayName: 'Use Node 8.x'
|
||||
inputs:
|
||||
versionSpec: 8.x
|
||||
|
||||
- script: npm install
|
||||
displayName: "Install Dependencies"
|
||||
workingDirectory: '$(Build.SourcesDirectory)\Extension'
|
||||
|
||||
- script: npm run compile
|
||||
displayName: "Compile Sources"
|
||||
workingDirectory: '$(Build.SourcesDirectory)\Extension'
|
||||
|
||||
- script: npm run pr-check
|
||||
displayName: 'Validate Extension/package.json'
|
||||
workingDirectory: '$(Build.SourcesDirectory)\Extension'
|
||||
|
||||
- script: npm run tslint
|
||||
displayName: 'Run Linter'
|
||||
workingDirectory: '$(Build.SourcesDirectory)\Extension'
|
||||
|
||||
- script: npm run pretest
|
||||
displayName: "Compile Test Sources"
|
||||
workingDirectory: '$(Build.SourcesDirectory)\Extension'
|
||||
|
||||
- script: 'npm run unitTests'
|
||||
displayName: 'Run unit tests'
|
||||
workingDirectory: '$(Build.SourcesDirectory)\Extension'
|
||||
|
||||
- script: 'node node_modules/vscode/bin/test'
|
||||
displayName: 'Run languageServer integration tests'
|
||||
workingDirectory: '$(Build.SourcesDirectory)\Extension'
|
||||
env:
|
||||
CODE_TESTS_PATH: '$(Build.SourcesDirectory)\Extension\out\test\integrationTests\languageServer'
|
||||
CODE_EXTENSIONS_PATH: '$(Build.SourcesDirectory)\Extension'
|
||||
CODE_TESTS_WORKSPACE: '$(Build.SourcesDirectory)\Extension\test\integrationTests\testAssets\SimpleCppProject'
|
||||
CODE_DISABLE_EXTENSIONS: 1
|
||||
|
||||
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
|
||||
displayName: 'Component Detection'
|
||||
continueOnError: true
|
||||
@@ -0,0 +1,57 @@
|
||||
parameters:
|
||||
name: ''
|
||||
pool: ''
|
||||
|
||||
jobs:
|
||||
- job: ${{ parameters.name }}
|
||||
pool: ${{ parameters.pool }}
|
||||
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
displayName: 'Use Node 8.x'
|
||||
inputs:
|
||||
versionSpec: 8.x
|
||||
|
||||
- script: npm install
|
||||
displayName: "Install Dependencies"
|
||||
workingDirectory: '$(Build.SourcesDirectory)/Extension'
|
||||
|
||||
- script: npm run compile
|
||||
displayName: "Compile Sources"
|
||||
workingDirectory: '$(Build.SourcesDirectory)/Extension'
|
||||
|
||||
- script: npm run pr-check
|
||||
displayName: 'Validate Extension/package.json'
|
||||
workingDirectory: '$(Build.SourcesDirectory)/Extension'
|
||||
|
||||
- script: npm run tslint
|
||||
displayName: 'Run Linter'
|
||||
workingDirectory: '$(Build.SourcesDirectory)/Extension'
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
/usr/bin/Xvfb :10 -ac >> /tmp/Xvfb.out 2>&1 &
|
||||
disown -ar
|
||||
displayName: 'Start xvfb'
|
||||
|
||||
- script: npm run pretest
|
||||
displayName: "Compile Test Sources"
|
||||
workingDirectory: '$(Build.SourcesDirectory)/Extension'
|
||||
|
||||
- script: 'npm run unitTests'
|
||||
displayName: 'Run unit tests'
|
||||
workingDirectory: '$(Build.SourcesDirectory)/Extension'
|
||||
|
||||
- script: 'node node_modules/vscode/bin/test'
|
||||
displayName: 'Run languageServer integration tests'
|
||||
workingDirectory: '$(Build.SourcesDirectory)/Extension'
|
||||
env:
|
||||
DISPLAY: :10
|
||||
CODE_TESTS_PATH: '$(Build.SourcesDirectory)/Extension/out/test/integrationTests/languageServer'
|
||||
CODE_EXTENSIONS_PATH: '$(Build.SourcesDirectory)/Extension'
|
||||
CODE_TESTS_WORKSPACE: '$(Build.SourcesDirectory)/Extension/test/integrationTests/testAssets/SimpleCppProject'
|
||||
CODE_DISABLE_EXTENSIONS: 1
|
||||
|
||||
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
|
||||
displayName: 'Component Detection'
|
||||
continueOnError: true
|
||||
Generated
+4565
-2567
File diff suppressed because it is too large
Load Diff
+322
-174
@@ -2,7 +2,7 @@
|
||||
"name": "cpptools",
|
||||
"displayName": "C/C++",
|
||||
"description": "C/C++ IntelliSense, debugging, and code browsing.",
|
||||
"version": "0.17.5",
|
||||
"version": "0.25.0",
|
||||
"publisher": "ms-vscode",
|
||||
"preview": true,
|
||||
"icon": "LanguageCCPP_color_128x.png",
|
||||
@@ -12,7 +12,7 @@
|
||||
},
|
||||
"license": "SEE LICENSE IN LICENSE.txt",
|
||||
"engines": {
|
||||
"vscode": "^1.23.0"
|
||||
"vscode": "^1.30.0"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/vscode-cpptools/issues",
|
||||
@@ -41,18 +41,19 @@
|
||||
"activationEvents": [
|
||||
"*"
|
||||
],
|
||||
"main": "./out/src/main",
|
||||
"main": "./dist/main",
|
||||
"contributes": {
|
||||
"problemMatchers": [
|
||||
{
|
||||
"name": "gcc",
|
||||
"source": "gcc",
|
||||
"owner": "cpptools",
|
||||
"fileLocation": [
|
||||
"relative",
|
||||
"${workspaceFolder}"
|
||||
],
|
||||
"pattern": {
|
||||
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
|
||||
"regexp": "^(.*):(\\d+):(\\d+):\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
@@ -63,7 +64,7 @@
|
||||
],
|
||||
"configuration": {
|
||||
"type": "object",
|
||||
"title": "C/C++ Configuration",
|
||||
"title": "C/C++",
|
||||
"properties": {
|
||||
"C_Cpp.clang_format_path": {
|
||||
"type": [
|
||||
@@ -77,13 +78,13 @@
|
||||
"C_Cpp.clang_format_style": {
|
||||
"type": "string",
|
||||
"default": "file",
|
||||
"description": "Coding style, currently supports: Visual Studio, LLVM, Google, Chromium, Mozilla, WebKit. Use \"file\" to load the style from a .clang-format file in the current or parent directory. Use \"{key: value, ...}\" to set specific parameters, e.g.: \"{ BasedOnStyle: LLVM, IndentWidth: 8 }\"",
|
||||
"description": "Coding style, currently supports: Visual Studio, LLVM, Google, Chromium, Mozilla, WebKit. Use \"file\" to load the style from a .clang-format file in the current or parent directory. Use {key: value, ...} to set specific parameters. For example, the \"Visual Studio\" style is similar to: { BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Allman, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, ColumnLimit: 0, AccessModifierOffset: -4 }",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.clang_format_fallbackStyle": {
|
||||
"type": "string",
|
||||
"default": "Visual Studio",
|
||||
"description": "Name of the predefined style used as a fallback in case clang-format is invoked with style \"file\" but the .clang-format file is not found. Possible values are Visual Studio, LLVM, Google, Chromium, Mozilla, WebKit, none, or use \"{key: value, ...}\" to set specific parameters, e.g.: \"{ BasedOnStyle: LLVM, IndentWidth: 8 }\"",
|
||||
"description": "Name of the predefined style used as a fallback in case clang-format is invoked with style \"file\" but the .clang-format file is not found. Possible values are Visual Studio, LLVM, Google, Chromium, Mozilla, WebKit, none, or use {key: value, ...} to set specific parameters. For example, the \"Visual Studio\" style is similar to: { BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Allman, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, ColumnLimit: 0, AccessModifierOffset: -4 }",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.clang_format_sortIncludes": {
|
||||
@@ -104,10 +105,11 @@
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Default",
|
||||
"Tag Parser"
|
||||
"Tag Parser",
|
||||
"Disabled"
|
||||
],
|
||||
"default": "Default",
|
||||
"description": "Controls the IntelliSense provider. \"Tag Parser\" provides \"fuzzy\" results that are not context-aware. \"Default\" provides context-aware results and is in preview mode - member list, hover tooltips, and error squiggles are currently implemented. Features not yet implemented in the new default engine will use the tag parser engine instead.",
|
||||
"description": "Controls the IntelliSense provider. \"Tag Parser\" provides \"fuzzy\" results that are not context-aware. \"Default\" provides context-aware results. \"Disabled\" turns off C/C++ language service features.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.intelliSenseEngineFallback": {
|
||||
@@ -116,7 +118,7 @@
|
||||
"Enabled",
|
||||
"Disabled"
|
||||
],
|
||||
"default": "Enabled",
|
||||
"default": "Disabled",
|
||||
"description": "Controls whether the IntelliSense engine will automatically switch to the Tag Parser for translation units containing #include errors.",
|
||||
"scope": "resource"
|
||||
},
|
||||
@@ -134,16 +136,17 @@
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Enabled",
|
||||
"Disabled"
|
||||
"Disabled",
|
||||
"EnabledIfIncludesResolve"
|
||||
],
|
||||
"default": "Enabled",
|
||||
"description": "Controls whether suspected compile errors detected by the IntelliSense engine will be reported back to the editor. Warnings about #includes that could not be located will always be reported to the editor. This setting is ignored by the Tag Parser engine.",
|
||||
"default": "EnabledIfIncludesResolve",
|
||||
"description": "Controls whether suspected compile errors detected by the IntelliSense engine will be reported back to the editor. This setting is ignored by the Tag Parser engine.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.dimInactiveRegions": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "Controls whether inactive preprocessor blocks are colored differently than active code. This setting is ignored by the Tag Parser engine.",
|
||||
"description": "Controls whether inactive preprocessor blocks are colored differently than active code. This setting has no effect if IntelliSense is disabled or if using the Default High Contrast theme.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.inactiveRegionOpacity": {
|
||||
@@ -154,6 +157,24 @@
|
||||
"minimum": 0.1,
|
||||
"maximum": 1
|
||||
},
|
||||
"C_Cpp.inactiveRegionForegroundColor": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"default": null,
|
||||
"description": "Controls the font coloring of inactive preprocessor blocks. Input is in the form a hexadecimal color code or a valid Theme Color. If not set, this defaults to the syntax coloring scheme of the editor. This setting only applies when inactive region dimming is enabled.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.inactiveRegionBackgroundColor": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"default": null,
|
||||
"description": "Controls the background coloring of inactive preprocessor blocks. Input is in the form a hexadecimal color code or a valid Theme Color. If not set, this defaults to transparent. This setting only applies when inactive region dimming is enabled.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.formatting": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
@@ -201,6 +222,16 @@
|
||||
"description": "Controls whether parsing of the non-active workspace files uses sleeps to avoid using 100% CPU. The values highest/high/medium/low correspond to approximately 100/75/50/25% CPU usage.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.workspaceSymbols": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"All",
|
||||
"Just My Code"
|
||||
],
|
||||
"default": "Just My Code",
|
||||
"description": "The symbols to include in the query results when 'Go to Symbol in Workspace' is invoked",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.exclusionPolicy": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
@@ -250,6 +281,29 @@
|
||||
"description": "Defines the editor behavior for when the Enter key is pressed inside a multiline or single line comment block.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.configurationWarnings": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Enabled",
|
||||
"Disabled"
|
||||
],
|
||||
"default": "Enabled",
|
||||
"description": "Determines whether pop up notifications will be shown when a configuration provider extension is unable to provide a configuration for a source file.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.intelliSenseCachePath": {
|
||||
"type": "string",
|
||||
"default": null,
|
||||
"description": "Defines the folder path for cached precompiled headers used by IntelliSense. The default cache path is \"%LocalAppData%/Microsoft/vscode-cpptools\" on Windows and \"~/.vscode-cpptools\" on Linux and Mac. The default path will be used if no path is specified or if a specified path is invalid.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.intelliSenseCacheSize": {
|
||||
"type": "number",
|
||||
"default": 5120,
|
||||
"description": "Maximum size of the per-workspace hard drive space in megabytes for cached precompiled headers; the actual usage may fluctuate around this value. The default size is 5120 MB. Precompiled header caching is disabled when the size is 0.",
|
||||
"scope": "resource",
|
||||
"minimum": 0
|
||||
},
|
||||
"C_Cpp.default.includePath": {
|
||||
"type": [
|
||||
"array",
|
||||
@@ -286,6 +340,16 @@
|
||||
"description": "The value to use in a configuration if \"macFrameworkPath\" is not specified, or the values to insert if \"${default}\" is present in \"macFrameworkPath\".",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.default.windowsSdkVersion": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"default": null,
|
||||
"description": "Version of the Windows SDK include path to use on Windows, e.g. '10.0.17134.0'.",
|
||||
"pattern": "^\\d{2}\\.\\d{1}\\.\\d{5}\\.\\d{1}$|^8\\.1$",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.default.compileCommands": {
|
||||
"type": [
|
||||
"string",
|
||||
@@ -314,7 +378,11 @@
|
||||
],
|
||||
"enum": [
|
||||
"msvc-x64",
|
||||
"clang-x64"
|
||||
"gcc-x64",
|
||||
"clang-x64",
|
||||
"msvc-x86",
|
||||
"gcc-x86",
|
||||
"clang-x86"
|
||||
],
|
||||
"default": null,
|
||||
"description": "The value to use in a configuration if \"intelliSenseMode\" is either not specified or set to \"${default}\".",
|
||||
@@ -329,6 +397,18 @@
|
||||
"description": "The value to use in a configuration if \"compilerPath\" is either not specified or set to \"${default}\".",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.default.compilerArgs": {
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"default": null,
|
||||
"description": "The value to use in configuration if \"compilerArgs\" is either not specified or set to \"${default}\".",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.default.cStandard": {
|
||||
"type": [
|
||||
"string",
|
||||
@@ -353,12 +433,22 @@
|
||||
"c++03",
|
||||
"c++11",
|
||||
"c++14",
|
||||
"c++17"
|
||||
"c++17",
|
||||
"c++20"
|
||||
],
|
||||
"default": null,
|
||||
"description": "The value to use in a configuration if \"cppStandard\" is either not specified or set to \"${default}\".",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.default.configurationProvider": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"default": null,
|
||||
"description": "The value to use in a configuration if \"configurationProvider\" is either not specified or set to \"${default}\".",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.default.browse.path": {
|
||||
"type": [
|
||||
"array",
|
||||
@@ -397,112 +487,148 @@
|
||||
"default": null,
|
||||
"description": "The value to use for the system include path. If set, it overrides the system include path acquired via \"compilerPath\" and \"compileCommands\" settings.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.default.enableConfigurationSquiggles": {
|
||||
"type": [
|
||||
"boolean",
|
||||
"null"
|
||||
],
|
||||
"default": null,
|
||||
"description": "Controls whether the extension will report errors detected in c_cpp_properties.json.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.updateChannel": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Default",
|
||||
"Insiders"
|
||||
],
|
||||
"default": "Default",
|
||||
"description": "Set to \"Insiders\" to automatically download and install the latest Insiders builds of the extension, which include upcoming features and bug fixes.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.experimentalFeatures": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Enabled",
|
||||
"Disabled"
|
||||
],
|
||||
"default": "Disabled",
|
||||
"description": "Controls whether \"experimental\" features are usable.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.suggestSnippets": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "If true, snippets are provided by the language server.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.enhancedColorization": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Enabled",
|
||||
"Disabled"
|
||||
],
|
||||
"default": "Enabled",
|
||||
"description": "If enabled, code is colorized based on IntelliSense. This setting has no effect if IntelliSense is disabled or if using the Default High Contrast theme.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"C_Cpp.vcpkg.enabled": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"markdownDescription": "Enable integration services for the [vcpkg dependency manager](https://aka.ms/vcpkg/).",
|
||||
"scope": "resource"
|
||||
}
|
||||
}
|
||||
},
|
||||
"commands": [
|
||||
{
|
||||
"command": "C_Cpp.ConfigurationSelect",
|
||||
"title": "Select a Configuration...",
|
||||
"category": "C/Cpp"
|
||||
"title": "%c_cpp.command.configurationSelect.title%",
|
||||
"category": "C/C++"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.ConfigurationEdit",
|
||||
"title": "Edit Configurations...",
|
||||
"category": "C/Cpp"
|
||||
"command": "C_Cpp.ConfigurationProviderSelect",
|
||||
"title": "%c_cpp.command.configurationProviderSelect.title%",
|
||||
"category": "C/C++"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.GoToDeclaration",
|
||||
"title": "Go to Declaration",
|
||||
"category": "C/Cpp"
|
||||
"command": "C_Cpp.ConfigurationEditJSON",
|
||||
"title": "%c_cpp.command.configurationEditJSON.title%",
|
||||
"category": "C/C++"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.PeekDeclaration",
|
||||
"title": "Peek Declaration",
|
||||
"category": "C/Cpp"
|
||||
"command": "C_Cpp.ConfigurationEditUI",
|
||||
"title": "%c_cpp.command.configurationEditUI.title%",
|
||||
"category": "C/C++"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.SwitchHeaderSource",
|
||||
"title": "Switch Header/Source",
|
||||
"category": "C/Cpp"
|
||||
"title": "%c_cpp.command.switchHeaderSource.title%",
|
||||
"category": "C/C++"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.Navigate",
|
||||
"title": "Navigate...",
|
||||
"category": "C/Cpp"
|
||||
"title": "%c_cpp.command.navigate.title%",
|
||||
"category": "C/C++"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.ToggleSnippets",
|
||||
"title": "Toggle Snippets",
|
||||
"category": "C/Cpp"
|
||||
"command": "C_Cpp.EnableErrorSquiggles",
|
||||
"title": "%c_cpp.command.enableErrorSquiggles.title%",
|
||||
"category": "C/C++"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.ToggleErrorSquiggles",
|
||||
"title": "Toggle Error Squiggles",
|
||||
"category": "C/Cpp"
|
||||
"command": "C_Cpp.DisableErrorSquiggles",
|
||||
"title": "%c_cpp.command.disableErrorSquiggles.title%",
|
||||
"category": "C/C++"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.ToggleIncludeFallback",
|
||||
"title": "Toggle IntelliSense Engine Fallback on Include Errors",
|
||||
"category": "C/Cpp"
|
||||
"title": "%c_cpp.command.toggleIncludeFallback.title%",
|
||||
"category": "C/C++"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.ToggleDimInactiveRegions",
|
||||
"title": "Toggle Inactive Region Colorization",
|
||||
"category": "C/Cpp"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.ShowReleaseNotes",
|
||||
"title": "Show Release Notes",
|
||||
"category": "C/Cpp"
|
||||
"title": "%c_cpp.command.toggleDimInactiveRegions.title%",
|
||||
"category": "C/C++"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.ResetDatabase",
|
||||
"title": "Reset IntelliSense Database",
|
||||
"category": "C/Cpp"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.PauseParsing",
|
||||
"title": "Pause Parsing",
|
||||
"category": "C/Cpp"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.ResumeParsing",
|
||||
"title": "Resume Parsing",
|
||||
"category": "C/Cpp"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.ShowParsingCommands",
|
||||
"title": "Show Parsing Commands",
|
||||
"category": "C/Cpp"
|
||||
"title": "%c_cpp.command.resetDatabase.title%",
|
||||
"category": "C/C++"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.TakeSurvey",
|
||||
"title": "Take Survey",
|
||||
"category": "C/Cpp"
|
||||
"title": "%c_cpp.command.takeSurvey.title%",
|
||||
"category": "C/C++"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.BuildAndDebugActiveFile",
|
||||
"title": "%c_cpp.command.buildAndDebugActiveFile.title%",
|
||||
"category": "C/C++"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.LogDiagnostics",
|
||||
"title": "%c_cpp.command.logDiagnostics.title%",
|
||||
"category": "C/C++"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.RescanWorkspace",
|
||||
"title": "%c_cpp.command.rescanWorkspace.title%",
|
||||
"category": "C/C++"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.VcpkgClipboardInstallSuggested",
|
||||
"title": "%c_cpp.command.vcpkgClipboardInstallSuggested.title%",
|
||||
"category": "C/C++"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.VcpkgOnlineHelpSuggested",
|
||||
"title": "%c_cpp.command.vcpkgOnlineHelpSuggested.title%",
|
||||
"category": "C/C++"
|
||||
}
|
||||
],
|
||||
"keybindings": [
|
||||
{
|
||||
"command": "C_Cpp.GoToDeclaration",
|
||||
"key": "Ctrl+F12",
|
||||
"when": "editorTextFocus && editorLangId == 'cpp'"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.GoToDeclaration",
|
||||
"key": "Ctrl+F12",
|
||||
"when": "editorTextFocus && editorLangId == 'c'"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.PeekDeclaration",
|
||||
"key": "Ctrl+Alt+F12",
|
||||
"when": "editorTextFocus && editorLangId == 'cpp'"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.PeekDeclaration",
|
||||
"key": "Ctrl+Alt+F12",
|
||||
"when": "editorTextFocus && editorLangId == 'c'"
|
||||
},
|
||||
{
|
||||
"command": "C_Cpp.SwitchHeaderSource",
|
||||
"key": "Alt+O",
|
||||
@@ -534,7 +660,6 @@
|
||||
"cpp"
|
||||
]
|
||||
},
|
||||
"adapterExecutableCommand": "extension.cppdbgAdapterExecutableCommand",
|
||||
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
|
||||
"variables": {
|
||||
"pickProcess": "extension.pickNativeProcess",
|
||||
@@ -654,12 +779,21 @@
|
||||
"type": "object",
|
||||
"default": {},
|
||||
"properties": {
|
||||
"name": "string",
|
||||
"value": "string"
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"default": []
|
||||
},
|
||||
"envFile": {
|
||||
"type": "string",
|
||||
"description": "Absolute path to a file containing environment variable definitions. This file has key value pairs separated by an equals sign per line. E.g. KEY=VALUE",
|
||||
"default": "${workspaceFolder}/.env"
|
||||
},
|
||||
"additionalSOLibSearchPath": {
|
||||
"type": "string",
|
||||
"description": "Semicolon separated list of directories to use to search for .so files. Example: \"c:\\dir1;c:\\dir2\".",
|
||||
@@ -727,7 +861,12 @@
|
||||
},
|
||||
"externalConsole": {
|
||||
"type": "boolean",
|
||||
"description": "If true, a console is launched for the debuggee. If false, no console is launched. Note this option is ignored in some cases for technical reasons.",
|
||||
"description": "If true, a console is launched for the debuggee. If false, on Linux and Windows, it will appear in the Integrated Console.",
|
||||
"default": false
|
||||
},
|
||||
"avoidWindowsConsoleRedirection": {
|
||||
"type": "boolean",
|
||||
"description": "If true, disables debuggee console redirection that is required for Integrated Terminal support.",
|
||||
"default": false
|
||||
},
|
||||
"sourceFileMap": {
|
||||
@@ -876,12 +1015,12 @@
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Optional process id to attach the debugger to. Use \"${command:pickProcesss}\" to get a list of local running processes to attach to. Note that some platforms require administrator privileges in order to attach to a process.",
|
||||
"description": "Optional process id to attach the debugger to. Use \"${command:pickProcess}\" to get a list of local running processes to attach to. Note that some platforms require administrator privileges in order to attach to a process.",
|
||||
"default": "${command:pickProcess}"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Optional process id to attach the debugger to. Use \"${command:pickProcesss}\" to get a list of local running processes to attach to. Note that some platforms require administrator privileges in order to attach to a process.",
|
||||
"description": "Optional process id to attach the debugger to. Use \"${command:pickProcess}\" to get a list of local running processes to attach to. Note that some platforms require administrator privileges in order to attach to a process.",
|
||||
"default": 0
|
||||
}
|
||||
]
|
||||
@@ -1022,7 +1161,6 @@
|
||||
"cpp"
|
||||
]
|
||||
},
|
||||
"adapterExecutableCommand": "extension.cppvsdbgAdapterExecutableCommand",
|
||||
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
|
||||
"variables": {
|
||||
"pickProcess": "extension.pickNativeProcess"
|
||||
@@ -1066,12 +1204,21 @@
|
||||
"type": "object",
|
||||
"default": {},
|
||||
"properties": {
|
||||
"name": "string",
|
||||
"value": "string"
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"default": []
|
||||
},
|
||||
"envFile": {
|
||||
"type": "string",
|
||||
"description": "Absolute path to a file containing environment variable definitions. This file has key value pairs separated by an equals sign per line. E.g. KEY=VALUE",
|
||||
"default": "${workspaceFolder}/.env"
|
||||
},
|
||||
"symbolSearchPath": {
|
||||
"type": "string",
|
||||
"description": "Semicolon separated list of directories to use to search for symbol (that is, pdb) files. Example: \"c:\\dir1;c:\\dir2\".",
|
||||
@@ -1104,6 +1251,11 @@
|
||||
"<source-path>": "<target-path>"
|
||||
}
|
||||
},
|
||||
"enableDebugHeap": {
|
||||
"type": "boolean",
|
||||
"description": "If false, the process will be launched with debug heap disabled. This sets the environment variable '_NO_DEBUG_HEAP' to '1'.",
|
||||
"default": false
|
||||
},
|
||||
"logging": {
|
||||
"type": "object",
|
||||
"description": "Optional flags to determine what types of messages should be logged to the Debug Console.",
|
||||
@@ -1154,12 +1306,12 @@
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Optional process id to attach the debugger to. Use \"${command:pickProcesss}\" to get a list of local running processes to attach to. Note that some platforms require administrator privileges in order to attach to a process.",
|
||||
"description": "Optional process id to attach the debugger to. Use \"${command:pickProcess}\" to get a list of local running processes to attach to. Note that some platforms require administrator privileges in order to attach to a process.",
|
||||
"default": "${command:pickProcess}"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Optional process id to attach the debugger to. Use \"${command:pickProcesss}\" to get a list of local running processes to attach to. Note that some platforms require administrator privileges in order to attach to a process.",
|
||||
"description": "Optional process id to attach the debugger to. Use \"${command:pickProcess}\" to get a list of local running processes to attach to. Note that some platforms require administrator privileges in order to attach to a process.",
|
||||
"default": 0
|
||||
}
|
||||
]
|
||||
@@ -1216,132 +1368,128 @@
|
||||
],
|
||||
"menus": {
|
||||
"editor/context": [
|
||||
{
|
||||
"when": "editorLangId == c",
|
||||
"command": "C_Cpp.GoToDeclaration",
|
||||
"group": "navigation@2"
|
||||
},
|
||||
{
|
||||
"when": "editorLangId == cpp",
|
||||
"command": "C_Cpp.GoToDeclaration",
|
||||
"group": "navigation@2"
|
||||
},
|
||||
{
|
||||
"when": "editorLangId == c",
|
||||
"command": "C_Cpp.PeekDeclaration",
|
||||
"group": "navigation@3"
|
||||
},
|
||||
{
|
||||
"when": "editorLangId == cpp",
|
||||
"command": "C_Cpp.PeekDeclaration",
|
||||
"group": "navigation@3"
|
||||
},
|
||||
{
|
||||
"when": "editorLangId == c",
|
||||
"command": "C_Cpp.SwitchHeaderSource",
|
||||
"group": "other@1"
|
||||
"group": "other1_navigation@1"
|
||||
},
|
||||
{
|
||||
"when": "editorLangId == cpp",
|
||||
"command": "C_Cpp.SwitchHeaderSource",
|
||||
"group": "other@1"
|
||||
"group": "other1_navigation@1"
|
||||
},
|
||||
{
|
||||
"when": "editorLangId == c",
|
||||
"command": "C_Cpp.Navigate",
|
||||
"group": "other@2"
|
||||
"group": "other1_navigation@2"
|
||||
},
|
||||
{
|
||||
"when": "editorLangId == cpp",
|
||||
"command": "C_Cpp.Navigate",
|
||||
"group": "other@2"
|
||||
"group": "other1_navigation@2"
|
||||
},
|
||||
{
|
||||
"when": "editorLangId == c",
|
||||
"command": "workbench.action.gotoSymbol",
|
||||
"group": "other@3"
|
||||
"group": "other1_navigation@3"
|
||||
},
|
||||
{
|
||||
"when": "editorLangId == cpp",
|
||||
"command": "workbench.action.gotoSymbol",
|
||||
"group": "other@3"
|
||||
"group": "other1_navigation@3"
|
||||
},
|
||||
{
|
||||
"when": "editorLangId == c",
|
||||
"command": "workbench.action.showAllSymbols",
|
||||
"group": "other@4"
|
||||
"group": "other1_navigation@4"
|
||||
},
|
||||
{
|
||||
"when": "editorLangId == cpp",
|
||||
"command": "workbench.action.showAllSymbols",
|
||||
"group": "other@4"
|
||||
"group": "other1_navigation@4"
|
||||
},
|
||||
{
|
||||
"when": "editorLangId == cpp",
|
||||
"command": "C_Cpp.BuildAndDebugActiveFile",
|
||||
"group": "other2_debug@1"
|
||||
},
|
||||
{
|
||||
"when": "editorLangId == c",
|
||||
"command": "C_Cpp.BuildAndDebugActiveFile",
|
||||
"group": "other2_debug@1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"configurationDefaults": {
|
||||
"[cpp]": {
|
||||
"editor.autoIndent": false
|
||||
"editor.wordBasedSuggestions": false
|
||||
},
|
||||
"[c]": {
|
||||
"editor.autoIndent": false
|
||||
}
|
||||
},
|
||||
"snippets": [
|
||||
{
|
||||
"language": "cpp",
|
||||
"path": "./cpp_snippets.json"
|
||||
"editor.wordBasedSuggestions": false
|
||||
},
|
||||
{
|
||||
"language": "c",
|
||||
"path": "./cpp_snippets.json"
|
||||
"[Log]": {
|
||||
"editor.wordWrap": "off"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"compile": "npm run vscode:prepublish",
|
||||
"compileDev": "npm run prepublishjs && webpack --mode development",
|
||||
"generateOptionsSchema": "gulp generateOptionsSchema",
|
||||
"integrationTests": "gulp integrationTests",
|
||||
"postinstall": "node ./node_modules/vscode/bin/install",
|
||||
"pretest": "tsc -p ./",
|
||||
"prepublishjs": "node ./tools/prepublish.js",
|
||||
"pretest": "tsc -p test.tsconfig.json",
|
||||
"pr-check": "gulp pr-check",
|
||||
"test": "gulp allTests",
|
||||
"tslint": "gulp tslint",
|
||||
"unitTests": "gulp unitTests",
|
||||
"vscode:prepublish": "node ./src/Support/prepublish.js",
|
||||
"watch": "tsc -watch -p ./"
|
||||
"vscode:prepublish": "npm run prepublishjs && webpack --mode production",
|
||||
"watch": "webpack --watch --mode development"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mocha": "^2.2.43",
|
||||
"@types/node": "^8.0.46",
|
||||
"gulp": "3.9.1",
|
||||
"gulp-env": "0.4.0",
|
||||
"gulp-mocha": "5.0.0",
|
||||
"gulp-tslint": "8.1.2",
|
||||
"mocha": "^4.0.1",
|
||||
"tslint": "5.8.0",
|
||||
"tslint-microsoft-contrib": "5.0.1",
|
||||
"tslint-no-unused-expression-chai": "0.0.3",
|
||||
"typescript": "^2.5.3",
|
||||
"vrsource-tslint-rules": "^5.8.2",
|
||||
"vscode": "^1.1.18"
|
||||
"@types/minimatch": "^3.0.3",
|
||||
"@types/mkdirp": "^0.5.2",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "^12.7.1",
|
||||
"@types/plist": "^3.0.2",
|
||||
"@types/tmp": "^0.1.0",
|
||||
"@types/webpack": "^4.32.1",
|
||||
"@types/yauzl": "^2.9.1",
|
||||
"async-child-process": "^1.1.1",
|
||||
"await-notify": "^1.0.1",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-env": "^0.4.0",
|
||||
"gulp-mocha": "^6.0.0",
|
||||
"gulp-tslint": "^8.1.4",
|
||||
"ts-loader": "^6.0.4",
|
||||
"tslint": "^5.18.0",
|
||||
"tslint-microsoft-contrib": "^6.2.0",
|
||||
"tslint-no-unused-expression-chai": "^0.1.4",
|
||||
"typescript": "^3.5.3",
|
||||
"vrsource-tslint-rules": "^6.0.0",
|
||||
"vscode": "^1.1.36",
|
||||
"webpack": "^4.39.1",
|
||||
"webpack-cli": "^3.3.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"http-proxy-agent": "~2.1.0",
|
||||
"https-proxy-agent": "~2.2.0",
|
||||
"jsonc-parser": "^1.0.0",
|
||||
"minimatch": "~3.0.4",
|
||||
"mkdirp": "~0.5.1",
|
||||
"tmp": "~0.0.33",
|
||||
"vscode-debugadapter": "~1.24.0",
|
||||
"vscode-debugprotocol": "~1.24.0",
|
||||
"vscode-extension-telemetry": "~0.0.11",
|
||||
"vscode-languageclient": "3.5.1",
|
||||
"yauzl": "~2.8.0"
|
||||
"escape-string-regexp": "^2.0.0",
|
||||
"http-proxy-agent": "^2.1.0",
|
||||
"https-proxy-agent": "^2.2.2",
|
||||
"jsonc-parser": "^2.1.0",
|
||||
"minimatch": "^3.0.4",
|
||||
"mkdirp": "^0.5.1",
|
||||
"plist": "^2.0.1",
|
||||
"tmp": "^0.1.0",
|
||||
"vscode-cpptools": "^3.0.1",
|
||||
"vscode-debugadapter": "^1.35.0",
|
||||
"vscode-debugprotocol": "^1.35.0",
|
||||
"vscode-extension-telemetry": "^0.1.2",
|
||||
"vscode-languageclient": "^5.2.1",
|
||||
"yauzl": "^2.10.0"
|
||||
},
|
||||
"runtimeDependencies": [
|
||||
{
|
||||
"description": "C/C++ language components (Linux / x86_64)",
|
||||
"url": "https://go.microsoft.com/fwlink/?linkid=875587",
|
||||
"url": "https://go.microsoft.com/fwlink/?linkid=2098277",
|
||||
"platforms": [
|
||||
"linux"
|
||||
],
|
||||
@@ -1355,7 +1503,7 @@
|
||||
},
|
||||
{
|
||||
"description": "C/C++ language components (Linux / x86)",
|
||||
"url": "https://go.microsoft.com/fwlink/?linkid=875588",
|
||||
"url": "https://go.microsoft.com/fwlink/?linkid=2098276",
|
||||
"platforms": [
|
||||
"linux"
|
||||
],
|
||||
@@ -1371,7 +1519,7 @@
|
||||
},
|
||||
{
|
||||
"description": "C/C++ language components (OS X)",
|
||||
"url": "https://go.microsoft.com/fwlink/?linkid=875589",
|
||||
"url": "https://go.microsoft.com/fwlink/?linkid=2098195",
|
||||
"platforms": [
|
||||
"darwin"
|
||||
],
|
||||
@@ -1382,7 +1530,7 @@
|
||||
},
|
||||
{
|
||||
"description": "C/C++ language components (Windows)",
|
||||
"url": "https://go.microsoft.com/fwlink/?linkid=875590",
|
||||
"url": "https://go.microsoft.com/fwlink/?linkid=2098194",
|
||||
"platforms": [
|
||||
"win32"
|
||||
],
|
||||
@@ -1436,7 +1584,7 @@
|
||||
},
|
||||
{
|
||||
"description": "Mono Framework Assemblies",
|
||||
"url": "https://go.microsoft.com/fwlink/?LinkId=816539",
|
||||
"url": "https://go.microsoft.com/fwlink/?LinkId=2027135",
|
||||
"platforms": [
|
||||
"linux",
|
||||
"darwin"
|
||||
@@ -1445,7 +1593,7 @@
|
||||
},
|
||||
{
|
||||
"description": "Mono Runtime (Linux / x86)",
|
||||
"url": "https://go.microsoft.com/fwlink/?LinkId=816540",
|
||||
"url": "https://go.microsoft.com/fwlink/?LinkId=2027410",
|
||||
"platforms": [
|
||||
"linux"
|
||||
],
|
||||
@@ -1460,7 +1608,7 @@
|
||||
},
|
||||
{
|
||||
"description": "Mono Runtime (Linux / x86_64)",
|
||||
"url": "https://go.microsoft.com/fwlink/?LinkId=816541",
|
||||
"url": "https://go.microsoft.com/fwlink/?LinkId=2027416",
|
||||
"platforms": [
|
||||
"linux"
|
||||
],
|
||||
@@ -1473,7 +1621,7 @@
|
||||
},
|
||||
{
|
||||
"description": "Mono Runtime (OS X)",
|
||||
"url": "https://go.microsoft.com/fwlink/?LinkId=816542",
|
||||
"url": "https://go.microsoft.com/fwlink/?LinkId=2027403",
|
||||
"platforms": [
|
||||
"darwin"
|
||||
],
|
||||
@@ -1496,7 +1644,7 @@
|
||||
},
|
||||
{
|
||||
"description": "Visual Studio Windows Debugger",
|
||||
"url": "https://go.microsoft.com/fwlink/?linkid=872985",
|
||||
"url": "https://go.microsoft.com/fwlink/?linkid=2082216",
|
||||
"platforms": [
|
||||
"win32"
|
||||
],
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"c_cpp.command.configurationSelect.title": "Scegli una configurazione...",
|
||||
"c_cpp.command.configurationProviderSelect.title": "Cambia provider configurazioni...",
|
||||
"c_cpp.command.configurationEditJSON.title": "Modifica configurazioni (JSON)",
|
||||
"c_cpp.command.configurationEditUI.title": "Modifica configurazioni (UI)",
|
||||
"c_cpp.command.switchHeaderSource.title": "Visualizza header/sorgente",
|
||||
"c_cpp.command.navigate.title": "Naviga...",
|
||||
"c_cpp.command.enableErrorSquiggles.title": "Attiva sottolineamento errori",
|
||||
"c_cpp.command.disableErrorSquiggles.title": "Disattiva sottolineamento errori",
|
||||
"c_cpp.command.toggleIncludeFallback.title": "Attiva/Disattiva motore di fallback IntelliSense negli errori di inclusione",
|
||||
"c_cpp.command.toggleDimInactiveRegions.title": "Attiva/Disattiva colorazione regioni inattive",
|
||||
"c_cpp.command.resetDatabase.title": "Reimposta il database di IntelliSense",
|
||||
"c_cpp.command.takeSurvey.title": "Partecipa al sondaggio",
|
||||
"c_cpp.command.buildAndDebugActiveFile.title": "Compila ed esegui il debug del file attivo",
|
||||
"c_cpp.command.logDiagnostics.title": "Registra diagnostica",
|
||||
"c_cpp.command.rescanWorkspace.title": "Ripetere l'analisi dell'area di lavoro",
|
||||
"c_cpp.command.vcpkgClipboardInstallSuggested.title": "Copia il comando di installazione di vcpkg negli appunti",
|
||||
"c_cpp.command.vcpkgOnlineHelpSuggested.title": "Visita la pagina di aiuto di vcpkg"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"c_cpp.command.configurationSelect.title": "Select a Configuration...",
|
||||
"c_cpp.command.configurationProviderSelect.title": "Change Configuration Provider...",
|
||||
"c_cpp.command.configurationEditJSON.title": "Edit Configurations (JSON)",
|
||||
"c_cpp.command.configurationEditUI.title": "Edit Configurations (UI)",
|
||||
"c_cpp.command.switchHeaderSource.title": "Switch Header/Source",
|
||||
"c_cpp.command.navigate.title": "Navigate...",
|
||||
"c_cpp.command.enableErrorSquiggles.title": "Enable Error Squiggles",
|
||||
"c_cpp.command.disableErrorSquiggles.title": "Disable Error Squiggles",
|
||||
"c_cpp.command.toggleIncludeFallback.title": "Toggle IntelliSense Engine Fallback on Include Errors",
|
||||
"c_cpp.command.toggleDimInactiveRegions.title": "Toggle Inactive Region Colorization",
|
||||
"c_cpp.command.resetDatabase.title": "Reset IntelliSense Database",
|
||||
"c_cpp.command.takeSurvey.title": "Take Survey",
|
||||
"c_cpp.command.buildAndDebugActiveFile.title": "Build and Debug Active File",
|
||||
"c_cpp.command.logDiagnostics.title": "Log Diagnostics",
|
||||
"c_cpp.command.rescanWorkspace.title": "Rescan Workspace",
|
||||
"c_cpp.command.vcpkgClipboardInstallSuggested.title": "Copy vcpkg install command to clipboard",
|
||||
"c_cpp.command.vcpkgOnlineHelpSuggested.title": "Visit the vcpkg help page"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"c_cpp.command.configurationSelect.title": "选择配置...",
|
||||
"c_cpp.command.configurationProviderSelect.title": "更换配置提供程序...",
|
||||
"c_cpp.command.configurationEditJSON.title": "编辑配置 (JSON)",
|
||||
"c_cpp.command.configurationEditUI.title": "编辑配置 (UI)",
|
||||
"c_cpp.command.switchHeaderSource.title": "切换头文件/源文件",
|
||||
"c_cpp.command.navigate.title": "导航...",
|
||||
"c_cpp.command.enableErrorSquiggles.title": "启用错误下划线",
|
||||
"c_cpp.command.disableErrorSquiggles.title": "禁用错误下划线",
|
||||
"c_cpp.command.toggleIncludeFallback.title": "切换IntelliSense引擎头文件包含错误回退",
|
||||
"c_cpp.command.toggleDimInactiveRegions.title": "切换非活跃区域着色",
|
||||
"c_cpp.command.resetDatabase.title": "重置IntelliSense数据",
|
||||
"c_cpp.command.takeSurvey.title": "调查问卷",
|
||||
"c_cpp.command.buildAndDebugActiveFile.title": "生成和调试当前文件",
|
||||
"c_cpp.command.logDiagnostics.title": "记录诊断",
|
||||
"c_cpp.command.rescanWorkspace.title": "重新扫描工作区",
|
||||
"c_cpp.command.vcpkgClipboardInstallSuggested.title": "将vcpkg install命令复制到剪贴板",
|
||||
"c_cpp.command.vcpkgOnlineHelpSuggested.title": "访问vcpkg帮助页面"
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
|
||||
export interface Environment {
|
||||
name: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export class ParsedEnvironmentFile {
|
||||
public Env: Environment[];
|
||||
public Warning: string | null;
|
||||
|
||||
private constructor(env: Environment[], warning: string | null) {
|
||||
this.Env = env;
|
||||
this.Warning = warning;
|
||||
}
|
||||
|
||||
public static CreateFromFile(envFile: string, initialEnv: Environment[] | undefined): ParsedEnvironmentFile {
|
||||
let content: string = fs.readFileSync(envFile, "utf8");
|
||||
return this.CreateFromContent(content, envFile, initialEnv);
|
||||
}
|
||||
|
||||
public static CreateFromContent(content: string, envFile: string, initialEnv: Environment[] | undefined): ParsedEnvironmentFile {
|
||||
|
||||
// Remove UTF-8 BOM if present
|
||||
if (content.charAt(0) === '\uFEFF') {
|
||||
content = content.substr(1);
|
||||
}
|
||||
|
||||
let parseErrors: string[] = [];
|
||||
let env: Map<string, any> = new Map();
|
||||
|
||||
if (initialEnv) {
|
||||
// Convert array to map to prevent duplicate keys being created.
|
||||
// If a duplicate key is found, replace it.
|
||||
initialEnv.forEach((e) => {
|
||||
env.set(e.name, e.value);
|
||||
});
|
||||
}
|
||||
|
||||
content.split("\n").forEach(line => {
|
||||
// Split the line between key and value
|
||||
const r: RegExpMatchArray = line.match(/^\s*([\w\.\-]+)\s*=\s*(.*)?\s*$/);
|
||||
|
||||
if (r !== null) {
|
||||
const key: string = r[1];
|
||||
let value: string = r[2] || "";
|
||||
if ((value.length > 0) && (value.charAt(0) === '"') && (value.charAt(value.length - 1) === '"')) {
|
||||
value = value.replace(/\\n/gm, "\n");
|
||||
}
|
||||
|
||||
value = value.replace(/(^['"]|['"]$)/g, "");
|
||||
|
||||
env.set(key, value);
|
||||
} else {
|
||||
// Blank lines and lines starting with # are no parse errors
|
||||
const comments: RegExp = new RegExp(/^\s*(#|$)/);
|
||||
if (!comments.test(line)) {
|
||||
parseErrors.push(line);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// show error message if single lines cannot get parsed
|
||||
let warning: string = null;
|
||||
if (parseErrors.length !== 0) {
|
||||
warning = "Ignoring non-parseable lines in envFile " + envFile + ": ";
|
||||
parseErrors.forEach(function (value, idx, array): void {
|
||||
warning += "\"" + value + "\"" + ((idx !== array.length - 1) ? ", " : ".");
|
||||
});
|
||||
}
|
||||
|
||||
// Convert env map back to array.
|
||||
const arrayEnv: Environment[] = [];
|
||||
for (let key of env.keys()) {
|
||||
arrayEnv.push({name: key, value: env.get(key)});
|
||||
}
|
||||
|
||||
return new ParsedEnvironmentFile(arrayEnv, warning);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||
* See 'LICENSE' in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
|
||||
import * as util from '../common';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
class RefreshButton implements vscode.QuickInputButton {
|
||||
get iconPath(): { dark: vscode.Uri; light: vscode.Uri } {
|
||||
const refreshImagePathDark: string = util.getExtensionFilePath("assets/Refresh_inverse.svg");
|
||||
const refreshImagePathLight: string = util.getExtensionFilePath("assets/Refresh.svg");
|
||||
|
||||
return {
|
||||
dark: vscode.Uri.file(refreshImagePathDark),
|
||||
light: vscode.Uri.file(refreshImagePathLight)
|
||||
};
|
||||
}
|
||||
|
||||
get tooltip(): string {
|
||||
return "Refresh process list";
|
||||
}
|
||||
}
|
||||
|
||||
export interface AttachItem extends vscode.QuickPickItem {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export function showQuickPick(getAttachItems: () => Promise<AttachItem[]>): Promise<string> {
|
||||
return getAttachItems().then(processEntries => {
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
let quickPick: vscode.QuickPick<AttachItem> = vscode.window.createQuickPick<AttachItem>();
|
||||
quickPick.title = "Attach to process";
|
||||
quickPick.canSelectMany = false;
|
||||
quickPick.matchOnDescription = true;
|
||||
quickPick.matchOnDetail = true;
|
||||
quickPick.placeholder = "Select the process to attach to";
|
||||
quickPick.items = processEntries;
|
||||
quickPick.buttons = [new RefreshButton()];
|
||||
|
||||
let disposables: vscode.Disposable[] = [];
|
||||
|
||||
quickPick.onDidTriggerButton(button => {
|
||||
getAttachItems().then(processEntries => quickPick.items = processEntries);
|
||||
}, undefined, disposables);
|
||||
|
||||
quickPick.onDidAccept(() => {
|
||||
if (quickPick.selectedItems.length !== 1) {
|
||||
reject(new Error("Process not selected"));
|
||||
}
|
||||
|
||||
let selectedId: string = quickPick.selectedItems[0].id;
|
||||
|
||||
disposables.forEach(item => item.dispose());
|
||||
quickPick.dispose();
|
||||
|
||||
resolve(selectedId);
|
||||
}, undefined, disposables);
|
||||
|
||||
quickPick.onDidHide(() => {
|
||||
disposables.forEach(item => item.dispose());
|
||||
quickPick.dispose();
|
||||
|
||||
reject(new Error("Process not selected."));
|
||||
}, undefined, disposables);
|
||||
|
||||
quickPick.show();
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
* See 'LICENSE' in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
|
||||
import { execChildProcess } from '../common';
|
||||
import { PsProcessParser } from './nativeAttach';
|
||||
import { AttachItem, showQuickPick } from './attachQuickPick';
|
||||
|
||||
import * as debugUtils from './utils';
|
||||
import * as fs from 'fs';
|
||||
@@ -13,10 +13,6 @@ import * as path from 'path';
|
||||
import * as util from '../common';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export interface AttachItem extends vscode.QuickPickItem {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface AttachItemsProvider {
|
||||
getAttachItems(): Promise<AttachItem[]>;
|
||||
}
|
||||
@@ -29,19 +25,7 @@ export class AttachPicker {
|
||||
if (!ready) {
|
||||
util.displayExtensionNotReadyPrompt();
|
||||
} else {
|
||||
return this.attachItemsProvider.getAttachItems()
|
||||
.then(processEntries => {
|
||||
let attachPickOptions: vscode.QuickPickOptions = {
|
||||
matchOnDescription: true,
|
||||
matchOnDetail: true,
|
||||
placeHolder: "Select the process to attach to"
|
||||
};
|
||||
|
||||
return vscode.window.showQuickPick(processEntries, attachPickOptions)
|
||||
.then(chosenProcess => {
|
||||
return chosenProcess ? chosenProcess.id : Promise.reject<string>(new Error("Process not selected."));
|
||||
});
|
||||
});
|
||||
return showQuickPick(() => this.attachItemsProvider.getAttachItems());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -74,7 +58,7 @@ export class RemoteAttachPicker {
|
||||
!fs.existsSync(pipeTransport.pipeProgram)) {
|
||||
const pipeProgramStr: string = pipeTransport.pipeProgram.toLowerCase().trim();
|
||||
const expectedArch: debugUtils.ArchType = debugUtils.ArchType[process.arch];
|
||||
|
||||
|
||||
// Check for pipeProgram
|
||||
if (!fs.existsSync(config.pipeTransport.pipeProgram)) {
|
||||
pipeProgram = debugUtils.ArchitectureReplacer.checkAndReplaceWSLPipeProgram(pipeProgramStr, expectedArch);
|
||||
@@ -84,7 +68,7 @@ export class RemoteAttachPicker {
|
||||
if (!pipeProgram && config.pipeTransport.pipeCwd) {
|
||||
const pipeCwdStr: string = config.pipeTransport.pipeCwd.toLowerCase().trim();
|
||||
const newPipeProgramStr: string = path.join(pipeCwdStr, pipeProgramStr);
|
||||
|
||||
|
||||
if (!fs.existsSync(newPipeProgramStr)) {
|
||||
pipeProgram = debugUtils.ArchitectureReplacer.checkAndReplaceWSLPipeProgram(newPipeProgramStr, expectedArch);
|
||||
}
|
||||
@@ -118,14 +102,29 @@ export class RemoteAttachPicker {
|
||||
});
|
||||
}
|
||||
|
||||
private getRemoteOSAndProcesses(pipeCmd: string): Promise<AttachItem[]> {
|
||||
// Commands to get OS and processes
|
||||
const command: string = `bash -c 'uname && if [ $(uname) == "Linux" ] ; then ${PsProcessParser.psLinuxCommand} ; elif [ $(uname) == "Darwin" ] ; ` +
|
||||
`then ${PsProcessParser.psDarwinCommand}; fi'`;
|
||||
// Creates a string to run on the host machine which will execute a shell script on the remote machine to retrieve OS and processes
|
||||
private getRemoteProcessCommand(): string {
|
||||
let innerQuote: string = `'`;
|
||||
let outerQuote: string = `"`;
|
||||
|
||||
return execChildProcess(`${pipeCmd} "${command}"`, null, this._channel).then(output => {
|
||||
// Must use single quotes around the whole command and double quotes for the argument to `sh -c` because Linux evaluates $() inside of double quotes.
|
||||
// Having double quotes for the outerQuote will have $(uname) replaced before it is sent to the remote machine.
|
||||
if (os.platform() !== "win32") {
|
||||
innerQuote = `"`;
|
||||
outerQuote = `'`;
|
||||
}
|
||||
|
||||
return `${outerQuote}sh -c ${innerQuote}uname && if [ $(uname) = \\\"Linux\\\" ] ; then ${PsProcessParser.psLinuxCommand} ; elif [ $(uname) = \\\"Darwin\\\" ] ; ` +
|
||||
`then ${PsProcessParser.psDarwinCommand}; fi${innerQuote}${outerQuote}`;
|
||||
}
|
||||
|
||||
private getRemoteOSAndProcesses(pipeCmd: string): Promise<AttachItem[]> {
|
||||
// Do not add any quoting in execCommand.
|
||||
const execCommand: string = `${pipeCmd} ${this.getRemoteProcessCommand()}`;
|
||||
|
||||
return util.execChildProcess(execCommand, null, this._channel).then(output => {
|
||||
// OS will be on first line
|
||||
// Processess will follow if listed
|
||||
// Processes will follow if listed
|
||||
let lines: string[] = output.split(/\r?\n/);
|
||||
|
||||
if (lines.length === 0) {
|
||||
|
||||
@@ -7,11 +7,83 @@ import * as debugUtils from './utils';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import { getBuildTasks, BuildTaskDefinition } from '../LanguageServer/extension';
|
||||
import * as util from '../common';
|
||||
import * as fs from 'fs';
|
||||
import * as Telemetry from '../telemetry';
|
||||
import { buildAndDebugActiveFileStr } from './extension';
|
||||
import * as logger from '../logger';
|
||||
|
||||
import { IConfiguration, IConfigurationSnippet, DebuggerType, MIConfigurations, WindowsConfigurations, WSLConfigurations, PipeTransportConfigurations } from './configurations';
|
||||
import { parse } from 'jsonc-parser';
|
||||
import { PlatformInformation } from '../platform';
|
||||
import { Environment, ParsedEnvironmentFile } from './ParsedEnvironmentFile';
|
||||
|
||||
abstract class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
|
||||
function isDebugLaunchStr(str: string): boolean {
|
||||
return str === "(gdb) Launch" || str === "(lldb) Launch" || str === "(Windows) Launch";
|
||||
}
|
||||
|
||||
/*
|
||||
* Retrieves configurations from a provider and displays them in a quickpick menu to be selected.
|
||||
* Ensures that the selected configuration's preLaunchTask (if existent) is populated in the user's task.json.
|
||||
* Automatically starts debugging for "Build and Debug" configurations.
|
||||
*/
|
||||
export class QuickPickConfigurationProvider implements vscode.DebugConfigurationProvider {
|
||||
private underlyingProvider: vscode.DebugConfigurationProvider;
|
||||
|
||||
public constructor(provider: CppConfigurationProvider) {
|
||||
this.underlyingProvider = provider;
|
||||
}
|
||||
|
||||
async provideDebugConfigurations(folder: vscode.WorkspaceFolder | undefined, token?: vscode.CancellationToken): Promise<vscode.DebugConfiguration[]> {
|
||||
const configs: vscode.DebugConfiguration[] = await this.underlyingProvider.provideDebugConfigurations(folder, token);
|
||||
const defaultConfig: vscode.DebugConfiguration = configs.find(config => isDebugLaunchStr(config.name));
|
||||
console.assert(defaultConfig);
|
||||
const editor: vscode.TextEditor = vscode.window.activeTextEditor;
|
||||
if (!editor || !util.fileIsCOrCppSource(editor.document.fileName) || configs.length <= 1) {
|
||||
return [defaultConfig];
|
||||
}
|
||||
interface MenuItem extends vscode.QuickPickItem {
|
||||
configuration: vscode.DebugConfiguration;
|
||||
}
|
||||
|
||||
const items: MenuItem[] = configs.map<MenuItem>(config => {
|
||||
let menuItem: MenuItem = {label: config.name, configuration: config};
|
||||
// Rename the menu item for the default configuration as its name is non-descriptive.
|
||||
if (isDebugLaunchStr(menuItem.label)) {
|
||||
menuItem.label = "Default Configuration";
|
||||
}
|
||||
return menuItem;
|
||||
});
|
||||
|
||||
const selection: MenuItem = await vscode.window.showQuickPick(items, {placeHolder: "Select a configuration"});
|
||||
if (!selection) {
|
||||
throw new Error(); // User canceled it.
|
||||
}
|
||||
if (selection.label.startsWith("cl.exe")) {
|
||||
if (!process.env.DevEnvDir || process.env.DevEnvDir.length === 0) {
|
||||
vscode.window.showErrorMessage('cl.exe build and debug is only usable when VS Code is run from the Developer Command Prompt for VS.');
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
if (selection.label.indexOf(buildAndDebugActiveFileStr()) !== -1 && selection.configuration.preLaunchTask) {
|
||||
try {
|
||||
await util.ensureBuildTaskExists(selection.configuration.preLaunchTask);
|
||||
await vscode.debug.startDebugging(folder, selection.configuration);
|
||||
Telemetry.logDebuggerEvent("buildAndDebug", { "success": "true" });
|
||||
} catch (e) {
|
||||
Telemetry.logDebuggerEvent("buildAndDebug", { "success": "false" });
|
||||
}
|
||||
}
|
||||
return [selection.configuration];
|
||||
}
|
||||
|
||||
resolveDebugConfiguration(folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration, token?: vscode.CancellationToken): vscode.ProviderResult<vscode.DebugConfiguration> {
|
||||
return this.underlyingProvider.resolveDebugConfiguration(folder, config, token);
|
||||
}
|
||||
}
|
||||
|
||||
class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
|
||||
private type: DebuggerType;
|
||||
private provider: IConfigurationAssetProvider;
|
||||
|
||||
@@ -23,45 +95,223 @@ abstract class CppConfigurationProvider implements vscode.DebugConfigurationProv
|
||||
/**
|
||||
* Returns a list of initial debug configurations based on contextual information, e.g. package.json or folder.
|
||||
*/
|
||||
provideDebugConfigurations(folder: vscode.WorkspaceFolder | undefined, token?: vscode.CancellationToken): vscode.ProviderResult<vscode.DebugConfiguration[]> {
|
||||
return this.provider.getInitialConfigurations(this.type);
|
||||
async provideDebugConfigurations(folder: vscode.WorkspaceFolder | undefined, token?: vscode.CancellationToken): Promise<vscode.DebugConfiguration[]> {
|
||||
let buildTasks: vscode.Task[] = await getBuildTasks(true);
|
||||
if (buildTasks.length === 0) {
|
||||
return Promise.resolve(this.provider.getInitialConfigurations(this.type));
|
||||
}
|
||||
const defaultConfig: vscode.DebugConfiguration = this.provider.getInitialConfigurations(this.type).find(config => {
|
||||
return isDebugLaunchStr(config.name);
|
||||
});
|
||||
console.assert(defaultConfig, "Could not find default debug configuration.");
|
||||
|
||||
const platformInfo: PlatformInformation = await PlatformInformation.GetPlatformInformation();
|
||||
const platform: string = platformInfo.platform;
|
||||
|
||||
// Filter out build tasks that don't match the currently selectede debug configuration type.
|
||||
buildTasks = buildTasks.filter((task: vscode.Task) => {
|
||||
if (defaultConfig.name === "(Windows) Launch") {
|
||||
if (task.name.startsWith("cl.exe")) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (!task.name.startsWith("cl.exe")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// Generate new configurations for each build task.
|
||||
// Generating a task is async, therefore we must *await* *all* map(task => config) Promises to resolve.
|
||||
let configs: vscode.DebugConfiguration[] = await Promise.all(buildTasks.map<Promise<vscode.DebugConfiguration>>(async task => {
|
||||
const definition: BuildTaskDefinition = task.definition as BuildTaskDefinition;
|
||||
const compilerName: string = path.basename(definition.compilerPath);
|
||||
|
||||
let newConfig: vscode.DebugConfiguration = {...defaultConfig}; // Copy enumerables and properties
|
||||
|
||||
newConfig.name = compilerName + buildAndDebugActiveFileStr();
|
||||
newConfig.preLaunchTask = task.name;
|
||||
newConfig.externalConsole = false;
|
||||
const exeName: string = path.join("${fileDirname}", "${fileBasenameNoExtension}");
|
||||
newConfig.program = platform === "win32" ? exeName + ".exe" : exeName;
|
||||
|
||||
return new Promise<vscode.DebugConfiguration>(resolve => {
|
||||
if (platform === "darwin") {
|
||||
return resolve(newConfig);
|
||||
} else {
|
||||
let debuggerName: string;
|
||||
if (compilerName.startsWith("clang")) {
|
||||
newConfig.MIMode = "lldb";
|
||||
const suffixIndex: number = compilerName.indexOf("-");
|
||||
const suffix: string = suffixIndex === -1 ? "" : compilerName.substr(suffixIndex);
|
||||
debuggerName = "lldb-mi" + suffix;
|
||||
} else if (compilerName === "cl.exe") {
|
||||
newConfig.miDebuggerPath = undefined;
|
||||
newConfig.type = "cppvsdbg";
|
||||
return resolve(newConfig);
|
||||
} else {
|
||||
debuggerName = "gdb";
|
||||
}
|
||||
|
||||
if (platform === "win32") {
|
||||
debuggerName += ".exe";
|
||||
}
|
||||
|
||||
const compilerDirname: string = path.dirname(definition.compilerPath);
|
||||
const debuggerPath: string = path.join(compilerDirname, debuggerName);
|
||||
fs.stat(debuggerPath, (err, stats: fs.Stats) => {
|
||||
if (!err && stats && stats.isFile) {
|
||||
newConfig.miDebuggerPath = debuggerPath;
|
||||
} else {
|
||||
// TODO should probably resolve a missing debugger in a more graceful fashion for win32.
|
||||
newConfig.miDebuggerPath = path.join("/usr", "bin", debuggerName);
|
||||
}
|
||||
return resolve(newConfig);
|
||||
});
|
||||
}
|
||||
});
|
||||
}));
|
||||
configs.push(defaultConfig);
|
||||
return configs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to add all missing attributes to the debug configuration being launched.
|
||||
*/
|
||||
resolveDebugConfiguration(folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration, token?: vscode.CancellationToken): vscode.ProviderResult<vscode.DebugConfiguration> {
|
||||
// Fail if cppvsdbg type is running on non-Windows
|
||||
if (config.type === 'cppvsdbg' && os.platform() !== 'win32') {
|
||||
vscode.window.showErrorMessage("Debugger of type: 'cppvsdbg' is only available on Windows. Use type: 'cppdbg' on the current OS platform.");
|
||||
return undefined;
|
||||
}
|
||||
if (config) {
|
||||
if (config.type === 'cppvsdbg') {
|
||||
// Fail if cppvsdbg type is running on non-Windows
|
||||
if (os.platform() !== 'win32') {
|
||||
logger.getOutputChannelLogger().showWarningMessage("Debugger of type: 'cppvsdbg' is only available on Windows. Use type: 'cppdbg' on the current OS platform.");
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Modify WSL config for OpenDebugAD7
|
||||
if (os.platform() === 'win32' &&
|
||||
config.pipeTransport &&
|
||||
config.pipeTransport.pipeProgram) {
|
||||
let replacedPipeProgram: string = null;
|
||||
const pipeProgramStr: string = config.pipeTransport.pipeProgram.toLowerCase().trim();
|
||||
// Disable debug heap by default, enable if 'enableDebugHeap' is set.
|
||||
if (!config.enableDebugHeap) {
|
||||
const disableDebugHeapEnvSetting : Environment = {"name" : "_NO_DEBUG_HEAP", "value" : "1"};
|
||||
|
||||
// OpenDebugAD7 is a 32-bit process. Make sure the WSL pipe transport is using the correct program.
|
||||
replacedPipeProgram = debugUtils.ArchitectureReplacer.checkAndReplaceWSLPipeProgram(pipeProgramStr, debugUtils.ArchType.ia32);
|
||||
|
||||
// If pipeProgram does not get replaced and there is a pipeCwd, concatenate with pipeProgramStr and attempt to replace.
|
||||
if (!replacedPipeProgram && !path.isAbsolute(pipeProgramStr) && config.pipeTransport.pipeCwd) {
|
||||
const pipeCwdStr: string = config.pipeTransport.pipeCwd.toLowerCase().trim();
|
||||
const newPipeProgramStr: string = path.join(pipeCwdStr, pipeProgramStr);
|
||||
|
||||
replacedPipeProgram = debugUtils.ArchitectureReplacer.checkAndReplaceWSLPipeProgram(newPipeProgramStr, debugUtils.ArchType.ia32);
|
||||
if (config.environment && util.isArray(config.environment)) {
|
||||
config.environment.push(disableDebugHeapEnvSetting);
|
||||
} else {
|
||||
config.environment = [disableDebugHeapEnvSetting];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (replacedPipeProgram) {
|
||||
config.pipeTransport.pipeProgram = replacedPipeProgram;
|
||||
// Add environment variables from .env file
|
||||
this.resolveEnvFile(config, folder);
|
||||
|
||||
this.resolveSourceFileMapVariables(config);
|
||||
|
||||
// Modify WSL config for OpenDebugAD7
|
||||
if (os.platform() === 'win32' &&
|
||||
config.pipeTransport &&
|
||||
config.pipeTransport.pipeProgram) {
|
||||
let replacedPipeProgram: string = null;
|
||||
const pipeProgramStr: string = config.pipeTransport.pipeProgram.toLowerCase().trim();
|
||||
|
||||
// OpenDebugAD7 is a 32-bit process. Make sure the WSL pipe transport is using the correct program.
|
||||
replacedPipeProgram = debugUtils.ArchitectureReplacer.checkAndReplaceWSLPipeProgram(pipeProgramStr, debugUtils.ArchType.ia32);
|
||||
|
||||
// If pipeProgram does not get replaced and there is a pipeCwd, concatenate with pipeProgramStr and attempt to replace.
|
||||
if (!replacedPipeProgram && !path.isAbsolute(pipeProgramStr) && config.pipeTransport.pipeCwd) {
|
||||
const pipeCwdStr: string = config.pipeTransport.pipeCwd.toLowerCase().trim();
|
||||
const newPipeProgramStr: string = path.join(pipeCwdStr, pipeProgramStr);
|
||||
|
||||
replacedPipeProgram = debugUtils.ArchitectureReplacer.checkAndReplaceWSLPipeProgram(newPipeProgramStr, debugUtils.ArchType.ia32);
|
||||
}
|
||||
|
||||
if (replacedPipeProgram) {
|
||||
config.pipeTransport.pipeProgram = replacedPipeProgram;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if config or type is not specified, return null to trigger VS Code to open a configuration file https://github.com/Microsoft/vscode/issues/54213
|
||||
return config && config.type ? config : null;
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
private resolveEnvFile(config: vscode.DebugConfiguration, folder: vscode.WorkspaceFolder): void {
|
||||
if (config.envFile) {
|
||||
// replace ${env:???} variables
|
||||
let envFilePath: string = util.resolveVariables(config.envFile, null);
|
||||
|
||||
try {
|
||||
if (folder && folder.uri && folder.uri.fsPath) {
|
||||
// Try to replace ${workspaceFolder} or ${workspaceRoot}
|
||||
envFilePath = envFilePath.replace(/(\${workspaceFolder}|\${workspaceRoot})/g, folder.uri.fsPath);
|
||||
}
|
||||
|
||||
const parsedFile: ParsedEnvironmentFile = ParsedEnvironmentFile.CreateFromFile(envFilePath, config["environment"]);
|
||||
|
||||
// show error message if single lines cannot get parsed
|
||||
if (parsedFile.Warning) {
|
||||
CppConfigurationProvider.showFileWarningAsync(parsedFile.Warning, config.envFile);
|
||||
}
|
||||
|
||||
config.environment = parsedFile.Env;
|
||||
|
||||
delete config.envFile;
|
||||
} catch (e) {
|
||||
throw new Error(`Failed to use envFile. Reason: ${e.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private resolveSourceFileMapVariables(config: vscode.DebugConfiguration): void {
|
||||
let messages: string[] = [];
|
||||
if (config.sourceFileMap) {
|
||||
for (const sourceFileMapSource of Object.keys(config.sourceFileMap)) {
|
||||
let message: string = "";
|
||||
const sourceFileMapTarget: string = config.sourceFileMap[sourceFileMapSource];
|
||||
|
||||
// TODO: pass config.environment as 'additionalEnvironment' to resolveVariables when it is { key: value } instead of { "key": key, "value": value }
|
||||
const newSourceFileMapSource: string = util.resolveVariables(sourceFileMapSource, null);
|
||||
const newSourceFileMapTarget: string = util.resolveVariables(sourceFileMapTarget, null);
|
||||
|
||||
let source: string = sourceFileMapSource;
|
||||
let target: string = sourceFileMapTarget;
|
||||
|
||||
if (sourceFileMapSource !== newSourceFileMapSource) {
|
||||
message = `\tReplacing sourcePath '${sourceFileMapSource}' with '${newSourceFileMapSource}'.`;
|
||||
delete config.sourceFileMap[sourceFileMapSource];
|
||||
source = newSourceFileMapSource;
|
||||
}
|
||||
|
||||
if (sourceFileMapTarget !== newSourceFileMapTarget) {
|
||||
// Add a space if source was changed, else just tab the target message.
|
||||
message += (message ? ' ' : '\t');
|
||||
message += `Replacing targetPath '${sourceFileMapTarget}' with '${newSourceFileMapTarget}'.`;
|
||||
target = newSourceFileMapTarget;
|
||||
}
|
||||
|
||||
if (message) {
|
||||
config.sourceFileMap[source] = target;
|
||||
messages.push(message);
|
||||
}
|
||||
}
|
||||
|
||||
if (messages.length > 0) {
|
||||
logger.getOutputChannel().appendLine("Resolving variables in sourceFileMap...");
|
||||
messages.forEach((message) => {
|
||||
logger.getOutputChannel().appendLine(message);
|
||||
});
|
||||
logger.showOutputChannel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static async showFileWarningAsync(message: string, fileName: string) : Promise<void> {
|
||||
const openItem: vscode.MessageItem = { title: 'Open envFile' };
|
||||
let result: vscode.MessageItem = await vscode.window.showWarningMessage(message, openItem);
|
||||
if (result && result.title === openItem.title) {
|
||||
let doc: vscode.TextDocument = await vscode.workspace.openTextDocument(fileName);
|
||||
if (doc) {
|
||||
vscode.window.showTextDocument(doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class CppVsDbgConfigurationProvider extends CppConfigurationProvider {
|
||||
@@ -71,7 +321,7 @@ export class CppVsDbgConfigurationProvider extends CppConfigurationProvider {
|
||||
}
|
||||
|
||||
export class CppDbgConfigurationProvider extends CppConfigurationProvider {
|
||||
public constructor(provider: IConfigurationAssetProvider) {
|
||||
public constructor(provider: IConfigurationAssetProvider) {
|
||||
super(provider, DebuggerType.cppdbg);
|
||||
}
|
||||
}
|
||||
@@ -101,12 +351,12 @@ abstract class DefaultConfigurationProvider implements IConfigurationAssetProvid
|
||||
|
||||
public getInitialConfigurations(debuggerType: DebuggerType): any {
|
||||
let configurationSnippet: IConfigurationSnippet[] = [];
|
||||
|
||||
|
||||
// Only launch configurations are initial configurations
|
||||
this.configurations.forEach(configuration => {
|
||||
configurationSnippet.push(configuration.GetLaunchConfiguration());
|
||||
configurationSnippet.push(configuration.GetLaunchConfiguration());
|
||||
});
|
||||
|
||||
|
||||
let initialConfigurations: any = configurationSnippet.filter(snippet => snippet.debuggerType === debuggerType && snippet.isInitialConfiguration)
|
||||
.map(snippet => JSON.parse(snippet.bodyText));
|
||||
|
||||
@@ -141,7 +391,7 @@ class WindowsConfigurationProvider extends DefaultConfigurationProvider {
|
||||
constructor() {
|
||||
super();
|
||||
this.configurations = [
|
||||
new MIConfigurations(this.MIMode, this.executable, this.pipeProgram, this.setupCommandsBlock),
|
||||
new MIConfigurations(this.MIMode, this.executable, this.pipeProgram, this.setupCommandsBlock),
|
||||
new PipeTransportConfigurations(this.MIMode, this.executable, this.pipeProgram, this.setupCommandsBlock),
|
||||
new WindowsConfigurations(this.MIMode, this.executable, this.pipeProgram, this.setupCommandsBlock),
|
||||
new WSLConfigurations(this.MIMode, this.executable, this.pipeProgram, this.setupCommandsBlock),
|
||||
@@ -157,7 +407,7 @@ class OSXConfigurationProvider extends DefaultConfigurationProvider {
|
||||
constructor() {
|
||||
super();
|
||||
this.configurations = [
|
||||
new MIConfigurations(this.MIMode, this.executable, this.pipeProgram),
|
||||
new MIConfigurations(this.MIMode, this.executable, this.pipeProgram),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -177,7 +427,7 @@ class LinuxConfigurationProvider extends DefaultConfigurationProvider {
|
||||
constructor() {
|
||||
super();
|
||||
this.configurations = [
|
||||
new MIConfigurations(this.MIMode, this.executable, this.pipeProgram, this.setupCommandsBlock),
|
||||
new MIConfigurations(this.MIMode, this.executable, this.pipeProgram, this.setupCommandsBlock),
|
||||
new PipeTransportConfigurations(this.MIMode, this.executable, this.pipeProgram, this.setupCommandsBlock)
|
||||
];
|
||||
}
|
||||
@@ -216,11 +466,11 @@ export class ConfigurationSnippetProvider implements vscode.CompletionItemProvid
|
||||
items = [];
|
||||
|
||||
// Make a copy of each snippet since we are adding a comma to the end of the insertText.
|
||||
this.snippets.forEach((item) => items.push(Object.assign({}, item)));
|
||||
this.snippets.forEach((item) => items.push({...item}));
|
||||
|
||||
items.map((item) => {
|
||||
item.insertText = item.insertText + ','; // Add comma
|
||||
});
|
||||
item.insertText = item.insertText + ','; // Add comma
|
||||
});
|
||||
}
|
||||
|
||||
return Promise.resolve(new vscode.CompletionList(items, true));
|
||||
|
||||
@@ -40,7 +40,7 @@ function createLaunchString(name: string, type: string, executable: string): str
|
||||
"stopAtEntry": false,
|
||||
"cwd": "$\{workspaceFolder\}",
|
||||
"environment": [],
|
||||
"externalConsole": true
|
||||
"externalConsole": false
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ export class MIConfigurations extends Configuration {
|
||||
let body: string = formatString(`{
|
||||
\t${indentJsonString(createLaunchString(name, this.miDebugger, this.executable))},
|
||||
\t"MIMode": "${this.MIMode}"{0}{1}
|
||||
}`, [this.miDebugger === "cppdbg" && os.platform() === "win32" ? `,${os.EOL}\t"miDebuggerPath": "/path/to/gdb"` : "",
|
||||
}`, [this.miDebugger === "cppdbg" && os.platform() === "win32" ? `,${os.EOL}\t"miDebuggerPath": "/path/to/gdb"` : "",
|
||||
this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);
|
||||
|
||||
return {
|
||||
@@ -123,7 +123,7 @@ this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalPrope
|
||||
public GetAttachConfiguration(): IConfigurationSnippet {
|
||||
let name: string = `(${this.MIMode}) Attach`;
|
||||
|
||||
let body: string = formatString(`{
|
||||
let body: string = formatString(`{
|
||||
\t${indentJsonString(createAttachString(name, this.miDebugger, this.executable))},
|
||||
\t"MIMode": "${this.MIMode}"{0}{1}
|
||||
}`, [this.miDebugger === "cppdbg" && os.platform() === "win32" ? `,${os.EOL}\t"miDebuggerPath": "/path/to/gdb"` : "",
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||
* See 'LICENSE' in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
|
||||
import * as vscode from "vscode";
|
||||
import * as util from '../common';
|
||||
import * as path from 'path';
|
||||
import * as os from 'os';
|
||||
|
||||
// Registers DebugAdapterDescriptorFactory for `cppdbg` and `cppvsdbg`. If it is not ready, it will prompt a wait for the download dialog.
|
||||
// NOTE: This file is not automatically tested.
|
||||
|
||||
abstract class AbstractDebugAdapterDescriptorFactory implements vscode.DebugAdapterDescriptorFactory {
|
||||
protected readonly context: vscode.ExtensionContext;
|
||||
|
||||
// This is important for the Mock Debugger since it can not use src/common
|
||||
constructor(context: vscode.ExtensionContext) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
abstract createDebugAdapterDescriptor(session: vscode.DebugSession, executable: vscode.DebugAdapterExecutable | undefined): vscode.ProviderResult<vscode.DebugAdapterDescriptor>;
|
||||
}
|
||||
|
||||
export class CppdbgDebugAdapterDescriptorFactory extends AbstractDebugAdapterDescriptorFactory {
|
||||
public static DEBUG_TYPE : string = "cppdbg";
|
||||
|
||||
constructor(context: vscode.ExtensionContext) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
createDebugAdapterDescriptor(session: vscode.DebugSession, executable: vscode.DebugAdapterExecutable | undefined): vscode.ProviderResult<vscode.DebugAdapterDescriptor> {
|
||||
return util.isExtensionReady().then(ready => {
|
||||
if (ready) {
|
||||
let command: string = path.join(this.context.extensionPath, './debugAdapters/OpenDebugAD7');
|
||||
|
||||
// Windows has the exe in debugAdapters/bin.
|
||||
if (os.platform() === 'win32') {
|
||||
command = path.join(this.context.extensionPath, "./debugAdapters/bin/OpenDebugAD7.exe");
|
||||
}
|
||||
|
||||
return new vscode.DebugAdapterExecutable(command, []);
|
||||
} else {
|
||||
throw new Error(util.extensionNotReadyString);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class CppvsdbgDebugAdapterDescriptorFactory extends AbstractDebugAdapterDescriptorFactory {
|
||||
public static DEBUG_TYPE : string = "cppvsdbg";
|
||||
|
||||
constructor(context: vscode.ExtensionContext) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
createDebugAdapterDescriptor(session: vscode.DebugSession, executable: vscode.DebugAdapterExecutable | undefined): vscode.ProviderResult<vscode.DebugAdapterDescriptor> {
|
||||
if (os.platform() !== 'win32') {
|
||||
vscode.window.showErrorMessage("Debugger type 'cppvsdbg' is not avaliable for non-Windows machines.");
|
||||
return null;
|
||||
} else {
|
||||
return util.isExtensionReady().then(ready => {
|
||||
if (ready) {
|
||||
return new vscode.DebugAdapterExecutable(
|
||||
path.join(this.context.extensionPath, './debugAdapters/vsdbg/bin/vsdbg.exe'),
|
||||
['--interpreter=vscode']
|
||||
);
|
||||
} else {
|
||||
throw new Error(util.extensionNotReadyString);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,14 +7,19 @@ import * as vscode from 'vscode';
|
||||
import * as os from 'os';
|
||||
import { AttachPicker, RemoteAttachPicker, AttachItemsProvider } from './attachToProcess';
|
||||
import { NativeAttachItemsProviderFactory } from './nativeAttach';
|
||||
import { ConfigurationAssetProviderFactory, CppVsDbgConfigurationProvider, CppDbgConfigurationProvider, ConfigurationSnippetProvider, IConfigurationAssetProvider } from './configurationProvider';
|
||||
import { QuickPickConfigurationProvider, ConfigurationAssetProviderFactory, CppVsDbgConfigurationProvider, CppDbgConfigurationProvider, ConfigurationSnippetProvider, IConfigurationAssetProvider } from './configurationProvider';
|
||||
import { CppdbgDebugAdapterDescriptorFactory, CppvsdbgDebugAdapterDescriptorFactory } from './debugAdapterDescriptorFactory';
|
||||
import * as util from '../common';
|
||||
import * as path from 'path';
|
||||
import * as Telemetry from '../telemetry';
|
||||
|
||||
// The extension deactivate method is asynchronous, so we handle the disposables ourselves instead of using extensonContext.subscriptions.
|
||||
let disposables: vscode.Disposable[] = [];
|
||||
|
||||
export function initialize(): void {
|
||||
export function buildAndDebugActiveFileStr(): string {
|
||||
return " build and debug active file";
|
||||
}
|
||||
|
||||
export function initialize(context: vscode.ExtensionContext): void {
|
||||
// Activate Process Picker Commands
|
||||
let attachItemsProvider: AttachItemsProvider = NativeAttachItemsProviderFactory.Get();
|
||||
let attacher: AttachPicker = new AttachPicker(attachItemsProvider);
|
||||
@@ -26,10 +31,94 @@ export function initialize(): void {
|
||||
let configurationProvider: IConfigurationAssetProvider = ConfigurationAssetProviderFactory.getConfigurationProvider();
|
||||
// On non-windows platforms, the cppvsdbg debugger will not be registered for initial configurations.
|
||||
// This will cause it to not show up on the dropdown list.
|
||||
let vsdbgProvider: CppVsDbgConfigurationProvider = null;
|
||||
if (os.platform() === 'win32') {
|
||||
disposables.push(vscode.debug.registerDebugConfigurationProvider('cppvsdbg', new CppVsDbgConfigurationProvider(configurationProvider)));
|
||||
vsdbgProvider = new CppVsDbgConfigurationProvider(configurationProvider);
|
||||
disposables.push(vscode.debug.registerDebugConfigurationProvider('cppvsdbg', new QuickPickConfigurationProvider(vsdbgProvider)));
|
||||
}
|
||||
disposables.push(vscode.debug.registerDebugConfigurationProvider('cppdbg', new CppDbgConfigurationProvider(configurationProvider)));
|
||||
const provider: CppDbgConfigurationProvider = new CppDbgConfigurationProvider(configurationProvider);
|
||||
disposables.push(vscode.debug.registerDebugConfigurationProvider('cppdbg', new QuickPickConfigurationProvider(provider)));
|
||||
|
||||
disposables.push(vscode.commands.registerTextEditorCommand("C_Cpp.BuildAndDebugActiveFile", async (textEditor: vscode.TextEditor, edit: vscode.TextEditorEdit, ...args: any[]) => {
|
||||
const folder: vscode.WorkspaceFolder = vscode.workspace.getWorkspaceFolder(textEditor.document.uri);
|
||||
if (!folder) {
|
||||
// Not enabled because we do not react to single-file mode correctly yet.
|
||||
// We get an ENOENT when the user's c_cpp_properties.json is attempted to be parsed.
|
||||
// The DefaultClient will also have its configuration accessed, but since it doesn't exist it errors out.
|
||||
vscode.window.showErrorMessage('This command is not yet available for single-file mode.');
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
if (!util.fileIsCOrCppSource(textEditor.document.uri.fsPath)) {
|
||||
vscode.window.showErrorMessage('Cannot build and debug because the active file is not a C or C++ source file.');
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
let configs: vscode.DebugConfiguration[] = (await provider.provideDebugConfigurations(folder)).filter(config => {
|
||||
return config.name.indexOf(buildAndDebugActiveFileStr()) !== -1;
|
||||
});
|
||||
|
||||
if (vsdbgProvider) {
|
||||
let vsdbgConfigs: vscode.DebugConfiguration[] = (await vsdbgProvider.provideDebugConfigurations(folder)).filter(config => {
|
||||
return config.name.indexOf(buildAndDebugActiveFileStr()) !== -1;
|
||||
});
|
||||
if (vsdbgConfigs) {
|
||||
configs.push(...vsdbgConfigs);
|
||||
}
|
||||
}
|
||||
|
||||
interface MenuItem extends vscode.QuickPickItem {
|
||||
configuration: vscode.DebugConfiguration;
|
||||
}
|
||||
|
||||
const items: MenuItem[] = configs.map<MenuItem>(config => {
|
||||
return {label: config.name, configuration: config};
|
||||
});
|
||||
|
||||
vscode.window.showQuickPick(items, {placeHolder: (items.length === 0 ? "No compiler found" : "Select a compiler")}).then(async selection => {
|
||||
if (!selection) {
|
||||
return; // User canceled it.
|
||||
}
|
||||
if (selection.label.startsWith("cl.exe")) {
|
||||
if (!process.env.DevEnvDir || process.env.DevEnvDir.length === 0) {
|
||||
vscode.window.showErrorMessage('cl.exe build and debug is only usable when VS Code is run from the Developer Command Prompt for VS.');
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (selection.configuration.preLaunchTask) {
|
||||
if (folder) {
|
||||
try {
|
||||
await util.ensureBuildTaskExists(selection.configuration.preLaunchTask);
|
||||
Telemetry.logDebuggerEvent("buildAndDebug", { "success": "false" });
|
||||
} catch (e) {
|
||||
if (e && e.message === util.failedToParseTasksJson) {
|
||||
vscode.window.showErrorMessage(util.failedToParseTasksJson);
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
} else {
|
||||
return Promise.resolve();
|
||||
// TODO uncomment this when single file mode works correctly.
|
||||
// const buildTasks: vscode.Task[] = await getBuildTasks(true);
|
||||
// const task: vscode.Task = buildTasks.find(task => task.name === selection.configuration.preLaunchTask);
|
||||
// await vscode.tasks.executeTask(task);
|
||||
// delete selection.configuration.preLaunchTask;
|
||||
}
|
||||
}
|
||||
|
||||
// Attempt to use the user's (possibly) modified configuration before using the generated one.
|
||||
try {
|
||||
await vscode.debug.startDebugging(folder, selection.configuration.name);
|
||||
Telemetry.logDebuggerEvent("buildAndDebug", { "success": "true" });
|
||||
} catch (e) {
|
||||
try {
|
||||
vscode.debug.startDebugging(folder, selection.configuration);
|
||||
} catch (e) {
|
||||
Telemetry.logDebuggerEvent("buildAndDebug", { "success": "false" });
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
configurationProvider.getConfigurationSnippets();
|
||||
|
||||
@@ -38,11 +127,13 @@ export function initialize(): void {
|
||||
language: 'jsonc',
|
||||
pattern: '**/launch.json'
|
||||
}];
|
||||
|
||||
// ConfigurationSnippetProvider needs to be initiallized after configurationProvider calls getConfigurationSnippets.
|
||||
disposables.push(vscode.languages.registerCompletionItemProvider(launchJsonDocumentSelector, new ConfigurationSnippetProvider(configurationProvider)));
|
||||
|
||||
// Activate Adapter Commands
|
||||
registerAdapterExecutableCommands();
|
||||
// Register Debug Adapters
|
||||
disposables.push(vscode.debug.registerDebugAdapterDescriptorFactory(CppvsdbgDebugAdapterDescriptorFactory.DEBUG_TYPE, new CppvsdbgDebugAdapterDescriptorFactory(context)));
|
||||
disposables.push(vscode.debug.registerDebugAdapterDescriptorFactory(CppdbgDebugAdapterDescriptorFactory.DEBUG_TYPE, new CppdbgDebugAdapterDescriptorFactory(context)));
|
||||
|
||||
vscode.Disposable.from(...disposables);
|
||||
}
|
||||
@@ -50,45 +141,3 @@ export function initialize(): void {
|
||||
export function dispose(): void {
|
||||
disposables.forEach(d => d.dispose());
|
||||
}
|
||||
|
||||
// Registers adapterExecutableCommands for cppdbg and cppvsdbg. If it is not ready, it will prompt waiting for the download.
|
||||
//
|
||||
// Note: util.extensionContext.extensionPath is needed for the commands because VsCode does not support relative paths for adapterExecutableComand
|
||||
function registerAdapterExecutableCommands(): void {
|
||||
disposables.push(vscode.commands.registerCommand('extension.cppdbgAdapterExecutableCommand', () => {
|
||||
return util.isExtensionReady().then(ready => {
|
||||
if (ready) {
|
||||
let command: string = path.join(util.extensionContext.extensionPath, './debugAdapters/OpenDebugAD7');
|
||||
|
||||
// Windows has the exe in debugAdapters/bin.
|
||||
if (os.platform() === 'win32') {
|
||||
command = path.join(util.extensionContext.extensionPath, "./debugAdapters/bin/OpenDebugAD7.exe");
|
||||
}
|
||||
|
||||
return {
|
||||
command: command
|
||||
};
|
||||
} else {
|
||||
throw new Error(util.extensionNotReadyString);
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
disposables.push(vscode.commands.registerCommand('extension.cppvsdbgAdapterExecutableCommand', () => {
|
||||
if (os.platform() !== 'win32') {
|
||||
vscode.window.showErrorMessage("Debugger type 'cppvsdbg' is not avaliable for non-Windows machines.");
|
||||
return null;
|
||||
} else {
|
||||
return util.isExtensionReady().then(ready => {
|
||||
if (ready) {
|
||||
return {
|
||||
command: path.join(util.extensionContext.extensionPath, './debugAdapters/vsdbg/bin/vsdbg.exe'),
|
||||
args: ['--interpreter=vscode']
|
||||
};
|
||||
} else {
|
||||
throw new Error(util.extensionNotReadyString);
|
||||
}
|
||||
});
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
|
||||
import * as child_process from 'child_process';
|
||||
import * as os from 'os';
|
||||
import { AttachItem, AttachItemsProvider } from './attachToProcess';
|
||||
import { AttachItemsProvider } from './attachToProcess';
|
||||
import { AttachItem } from './attachQuickPick';
|
||||
|
||||
class Process {
|
||||
export class Process {
|
||||
constructor(public name: string, public pid: string, public commandLine: string) { }
|
||||
|
||||
public toAttachItem(): AttachItem {
|
||||
@@ -111,8 +112,8 @@ export class PsProcessParser {
|
||||
// Note that comm on Linux systems is truncated to 16 characters:
|
||||
// https://bugzilla.redhat.com/show_bug.cgi?id=429565
|
||||
// Since 'args' contains the full path to the executable, even if truncated, searching will work as desired.
|
||||
public static get psLinuxCommand(): string { return `ps -axww -o pid=,comm=${PsProcessParser.commColumnTitle},args=`; }
|
||||
public static get psDarwinCommand(): string { return `ps -axww -o pid=,comm=${PsProcessParser.commColumnTitle},args= -c`; }
|
||||
public static get psLinuxCommand(): string { return `ps axww -o pid=,comm=${PsProcessParser.commColumnTitle},args=`; }
|
||||
public static get psDarwinCommand(): string { return `ps axww -o pid=,comm=${PsProcessParser.commColumnTitle},args= -c`; }
|
||||
|
||||
// Only public for tests.
|
||||
public static ParseProcessFromPs(processes: string): Process[] {
|
||||
|
||||
@@ -34,8 +34,8 @@ export class ArchitectureReplacer {
|
||||
return replacedPipeProgram;
|
||||
}
|
||||
|
||||
// Checks to see if the folder name is in the path using both win and unix style path seperators.
|
||||
// Returns the path seperator it detected if the folder is in the path.
|
||||
// Checks to see if the folder name is in the path using both win and unix style path separators.
|
||||
// Returns the path separator it detected if the folder is in the path.
|
||||
// Or else it returns empty string to indicate it did not find it in the path.
|
||||
public static checkForFolderInPath(path: string, folder: string): string {
|
||||
if (path.indexOf(`/${folder}/`) >= 0) {
|
||||
@@ -46,4 +46,4 @@ export class ArchitectureReplacer {
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1316
-282
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,7 @@ import * as util from '../common';
|
||||
import * as telemetry from '../telemetry';
|
||||
import * as cpptools from './client';
|
||||
import * as path from 'path';
|
||||
import { getCustomConfigProviders } from './customProviders';
|
||||
|
||||
const defaultClientKey: string = "@@default@@";
|
||||
export interface ClientKey {
|
||||
@@ -98,7 +99,7 @@ export class ClientCollection {
|
||||
* creates a new client to replace one that crashed.
|
||||
*/
|
||||
public replace(client: cpptools.Client, transferFileOwnership: boolean): cpptools.Client {
|
||||
let key: string = undefined;
|
||||
let key: string;
|
||||
for (let pair of this.languageClients) {
|
||||
if (pair[1] === client) {
|
||||
key = pair[0];
|
||||
@@ -118,7 +119,7 @@ export class ClientCollection {
|
||||
this.languageClients.set(key, cpptools.createNullClient());
|
||||
}
|
||||
|
||||
if (this.activeClient === client) {
|
||||
if (this.activeClient === client && this.activeDocument) {
|
||||
this.activeClient = this.getClientFor(this.activeDocument.uri);
|
||||
this.activeClient.activeDocumentChanged(this.activeDocument);
|
||||
}
|
||||
@@ -153,12 +154,12 @@ export class ClientCollection {
|
||||
client.TrackedDocuments.forEach(document => this.transferOwnership(document, client));
|
||||
client.TrackedDocuments.clear();
|
||||
|
||||
if (this.activeClient === client) {
|
||||
if (this.activeClient === client && this.activeDocument) {
|
||||
// Need to make a different client the active client.
|
||||
this.activeClient = this.getClientFor(this.activeDocument.uri);
|
||||
this.activeClient.activeDocumentChanged(this.activeDocument);
|
||||
// may not need this, the navigation UI should not have changed.
|
||||
// this.activeClient.selectionChanged(vscode.window.activeTextEditor.selection.start);
|
||||
// this.activeClient.selectionChanged(Range.create(vscode.window.activeTextEditor.selection.start, vscode.window.activeTextEditor.selection.end);
|
||||
}
|
||||
|
||||
client.dispose();
|
||||
@@ -174,7 +175,8 @@ export class ClientCollection {
|
||||
}
|
||||
|
||||
private onDidOpenTextDocument(document: vscode.TextDocument): void {
|
||||
if (document.languageId === "c" || document.languageId === "cpp") {
|
||||
if (document.languageId === "c" || document.languageId === "cpp"
|
||||
|| document.languageId === "json" && document.uri.fsPath.endsWith("c_cpp_properties.json")) {
|
||||
// Make sure a client exists for this document's workspace.
|
||||
this.getClientFor(document.uri);
|
||||
}
|
||||
@@ -187,7 +189,9 @@ export class ClientCollection {
|
||||
} else {
|
||||
let key: string = util.asFolder(folder.uri);
|
||||
if (!this.languageClients.has(key)) {
|
||||
this.languageClients.set(key, cpptools.createClient(this, folder));
|
||||
let newClient: cpptools.Client = cpptools.createClient(this, folder);
|
||||
this.languageClients.set(key, newClient);
|
||||
getCustomConfigProviders().forEach(provider => newClient.onRegisterCustomConfigurationProvider(provider));
|
||||
}
|
||||
return this.languageClients.get(key);
|
||||
}
|
||||
@@ -207,4 +211,4 @@ export class ClientCollection {
|
||||
this.languageClients.clear();
|
||||
return Promise.all(promises).then(() => undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,657 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||
* See 'LICENSE' in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
|
||||
import * as path from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import * as util from '../common';
|
||||
import { CppSettings, OtherSettings, TextMateRule, TextMateRuleSettings } from './settings';
|
||||
import * as jsonc from 'jsonc-parser';
|
||||
import * as plist from 'plist';
|
||||
|
||||
export enum TokenKind {
|
||||
// These need to match the token_kind enum in the server
|
||||
|
||||
// Semantic tokens
|
||||
Macro,
|
||||
Enumerator,
|
||||
GlobalVariable,
|
||||
LocalVariable,
|
||||
Parameter,
|
||||
Type,
|
||||
RefType,
|
||||
ValueType,
|
||||
Function,
|
||||
MemberFunction,
|
||||
MemberField,
|
||||
StaticMemberFunction,
|
||||
StaticMemberField,
|
||||
Property,
|
||||
Event,
|
||||
ClassTemplate,
|
||||
GenericType,
|
||||
FunctionTemplate,
|
||||
Namespace,
|
||||
Label,
|
||||
UdlRaw,
|
||||
UdlNumber,
|
||||
UdlString,
|
||||
OperatorFunction,
|
||||
MemberOperator,
|
||||
NewDelete,
|
||||
|
||||
Count
|
||||
}
|
||||
|
||||
interface VersionedEdits {
|
||||
editVersion: number;
|
||||
changes: readonly vscode.TextDocumentContentChangeEvent[];
|
||||
}
|
||||
|
||||
class ThemeStyle {
|
||||
foreground: string;
|
||||
background: string;
|
||||
fontStyle: string;
|
||||
}
|
||||
|
||||
export class ColorizationSettings {
|
||||
private uri: vscode.Uri;
|
||||
private pendingTask: util.BlockingTask<any>;
|
||||
private editorBackground: string;
|
||||
|
||||
public themeStyleCMap: ThemeStyle[] = [];
|
||||
public themeStyleCppMap: ThemeStyle[] = [];
|
||||
|
||||
private static readonly scopeToTokenColorNameMap = new Map<string, string>([
|
||||
["comment", "comments"],
|
||||
["string", "strings"],
|
||||
["keyword.operator", "keywords"],
|
||||
["keyword.control", "keywords"],
|
||||
["constant.numeric", "numbers"],
|
||||
["entity.name.type", "types"],
|
||||
["entity.name.class", "types"],
|
||||
["entity.name.function", "functions"],
|
||||
["variable", "variables"]
|
||||
]);
|
||||
|
||||
constructor(uri: vscode.Uri) {
|
||||
this.uri = uri;
|
||||
this.reload();
|
||||
}
|
||||
|
||||
// Given a TextMate rule 'settings' node, update a ThemeStyle to include any color or style information
|
||||
private updateStyleFromTextMateRuleSettings(baseStyle: ThemeStyle, textMateRuleSettings: TextMateRuleSettings): void {
|
||||
if (textMateRuleSettings.foreground) {
|
||||
baseStyle.foreground = textMateRuleSettings.foreground;
|
||||
}
|
||||
if (textMateRuleSettings.background && textMateRuleSettings.background.toUpperCase() !== this.editorBackground.toUpperCase()) {
|
||||
baseStyle.background = textMateRuleSettings.background;
|
||||
}
|
||||
// Any (even empty) string for fontStyle removes inherited value
|
||||
if (textMateRuleSettings.fontStyle) {
|
||||
baseStyle.fontStyle = textMateRuleSettings.fontStyle;
|
||||
} else if (textMateRuleSettings.fontStyle === "") {
|
||||
baseStyle.fontStyle = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
// If the scope can be found in a set of TextMate rules, apply it to both C and Cpp ThemeStyle's
|
||||
private findThemeStyleForScope(baseCStyle: ThemeStyle, baseCppStyle: ThemeStyle, scope: string, textMateRules: TextMateRule[]): void {
|
||||
if (textMateRules) {
|
||||
let match: TextMateRule = textMateRules.find(e => e.settings && (e.scope === scope || ((e.scope instanceof Array) && e.scope.indexOf(scope) > -1)));
|
||||
if (match) {
|
||||
if (baseCStyle) {
|
||||
this.updateStyleFromTextMateRuleSettings(baseCStyle, match.settings);
|
||||
}
|
||||
if (baseCppStyle) {
|
||||
this.updateStyleFromTextMateRuleSettings(baseCppStyle, match.settings);
|
||||
}
|
||||
}
|
||||
|
||||
match = textMateRules.find(e => e.settings && (e.scope === "source " + scope || ((e.scope instanceof Array) && e.scope.indexOf("source " + scope) > -1)));
|
||||
if (match) {
|
||||
if (baseCStyle) {
|
||||
this.updateStyleFromTextMateRuleSettings(baseCStyle, match.settings);
|
||||
}
|
||||
if (baseCppStyle) {
|
||||
this.updateStyleFromTextMateRuleSettings(baseCppStyle, match.settings);
|
||||
}
|
||||
}
|
||||
|
||||
if (baseCStyle) {
|
||||
match = textMateRules.find(e => e.settings && (e.scope === "source.c " + scope || ((e.scope instanceof Array) && e.scope.indexOf("source.c " + scope) > -1)));
|
||||
if (match) {
|
||||
this.updateStyleFromTextMateRuleSettings(baseCStyle, match.settings);
|
||||
}
|
||||
}
|
||||
|
||||
if (baseCppStyle) {
|
||||
match = textMateRules.find(e => e.settings && (e.scope === "source.cpp " + scope || ((e.scope instanceof Array) && e.scope.indexOf("source.cpp " + scope) > -1)));
|
||||
if (match) {
|
||||
this.updateStyleFromTextMateRuleSettings(baseCppStyle, match.settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// For a specific scope cascase all potential sources of style information to create a final ThemeStyle
|
||||
private calculateThemeStyleForScope(baseCStyle: ThemeStyle, baseCppStyle: ThemeStyle, scope: string, themeName: string, themeTextMateRules: TextMateRule[][]): void {
|
||||
// Search for settings with this scope in current theme
|
||||
themeTextMateRules.forEach((rules) => {
|
||||
this.findThemeStyleForScope(baseCStyle, baseCppStyle, scope, rules);
|
||||
});
|
||||
|
||||
let otherSettings: OtherSettings = new OtherSettings(this.uri);
|
||||
|
||||
// Next in priority would be a global user override of token color of the equivilent scope
|
||||
let colorTokenName: string | undefined = ColorizationSettings.scopeToTokenColorNameMap.get(scope);
|
||||
if (colorTokenName) {
|
||||
let settingValue: string = otherSettings.getCustomColorToken(colorTokenName);
|
||||
if (settingValue) {
|
||||
if (baseCStyle) {
|
||||
baseCStyle.foreground = settingValue;
|
||||
}
|
||||
if (baseCppStyle) {
|
||||
baseCppStyle.foreground = settingValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Next in priority would be a global user override of this scope in textMateRules
|
||||
this.findThemeStyleForScope(baseCStyle, baseCppStyle, scope, otherSettings.customTextMateRules);
|
||||
|
||||
// Next in priority would be a theme-specific user override of token color of the equivilent scope
|
||||
if (colorTokenName) {
|
||||
let settingValue: string = otherSettings.getCustomThemeSpecificColorToken(colorTokenName, themeName);
|
||||
if (settingValue) {
|
||||
if (baseCStyle) {
|
||||
baseCStyle.foreground = settingValue;
|
||||
}
|
||||
if (baseCppStyle) {
|
||||
baseCppStyle.foreground = settingValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Next in priority would be a theme-specific user override of this scope in textMateRules
|
||||
let textMateRules: TextMateRule[] = otherSettings.getCustomThemeSpecificTextMateRules(themeName);
|
||||
this.findThemeStyleForScope(baseCStyle, baseCppStyle, scope, textMateRules);
|
||||
}
|
||||
|
||||
// For each level of the scope, look of style information
|
||||
private calculateStyleForToken(tokenKind: TokenKind, scope: string, themeName: string, themeTextMateRules: TextMateRule[][]): void {
|
||||
// Try scopes, from most general to most specific, apply style in cascading manner
|
||||
let parts: string[] = scope.split(".");
|
||||
let accumulatedScope: string = "";
|
||||
for (let i: number = 0; i < parts.length; i++) {
|
||||
accumulatedScope += parts[i];
|
||||
this.calculateThemeStyleForScope(this.themeStyleCMap[tokenKind], this.themeStyleCppMap[tokenKind], accumulatedScope, themeName, themeTextMateRules);
|
||||
this.calculateThemeStyleForScope(this.themeStyleCMap[tokenKind], null, accumulatedScope + ".c", themeName, themeTextMateRules);
|
||||
this.calculateThemeStyleForScope(null, this.themeStyleCppMap[tokenKind], accumulatedScope + ".cpp", themeName, themeTextMateRules);
|
||||
accumulatedScope += ".";
|
||||
}
|
||||
}
|
||||
|
||||
public syncWithLoadingSettings(f: () => any): void {
|
||||
this.pendingTask = new util.BlockingTask<void>(f, this.pendingTask);
|
||||
}
|
||||
|
||||
public updateStyles(themeName: string, defaultStyle: ThemeStyle, textMateRules: TextMateRule[][]): void {
|
||||
this.themeStyleCMap = new Array<ThemeStyle>(TokenKind.Count);
|
||||
this.themeStyleCppMap = new Array<ThemeStyle>(TokenKind.Count);
|
||||
|
||||
// Populate with unique objects, as they will be individual modified in place
|
||||
for (let i: number = 0; i < TokenKind.Count; i++) {
|
||||
this.themeStyleCMap[i] = {...defaultStyle};
|
||||
this.themeStyleCppMap[i] = {...defaultStyle};
|
||||
}
|
||||
|
||||
this.calculateStyleForToken(TokenKind.Macro, "entity.name.function.preprocessor", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.Enumerator, "variable.other.enummember", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.GlobalVariable, "variable.other.global", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.LocalVariable, "variable.other.local", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.Parameter, "variable.parameter", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.Type, "entity.name.type.class", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.RefType, "entity.name.type.class.reference", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.ValueType, "entity.name.type.class.value", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.Function, "entity.name.function", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.MemberFunction, "entity.name.function.member", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.MemberField, "variable.other.property", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.StaticMemberFunction, "entity.name.function.member.static", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.StaticMemberField, "variable.other.property.static", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.Property, "variable.other.property.cli", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.Event, "variable.other.event", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.ClassTemplate, "entity.name.type.class.templated", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.GenericType, "entity.name.type.class.generic", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.FunctionTemplate, "entity.name.function.templated", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.Namespace, "entity.name.namespace", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.Label, "entity.name.label", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.UdlRaw, "entity.name.operator.custom-literal", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.UdlNumber, "entity.name.operator.custom-literal.number", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.UdlString, "entity.name.operator.custom-literal.string", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.OperatorFunction, "entity.name.function.operator", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.MemberOperator, "entity.name.function.operator.member", themeName, textMateRules);
|
||||
this.calculateStyleForToken(TokenKind.NewDelete, "keyword.operator.new", themeName, textMateRules);
|
||||
}
|
||||
|
||||
public async loadTheme(themePath: string, defaultStyle: ThemeStyle): Promise<TextMateRule[][]> {
|
||||
let rules: TextMateRule[][] = [];
|
||||
if (await util.checkFileExists(themePath)) {
|
||||
let themeContentText: string = await util.readFileText(themePath);
|
||||
let themeContent: any;
|
||||
let textMateRules: TextMateRule[];
|
||||
if (themePath.endsWith("tmTheme")) {
|
||||
themeContent = plist.parse(themeContentText);
|
||||
if (themeContent) {
|
||||
textMateRules = themeContent.settings;
|
||||
}
|
||||
} else {
|
||||
themeContent = jsonc.parse(themeContentText);
|
||||
if (themeContent) {
|
||||
textMateRules = themeContent.tokenColors;
|
||||
if (themeContent.include) {
|
||||
// parse included theme file
|
||||
let includedThemePath: string = path.join(path.dirname(themePath), themeContent.include);
|
||||
rules = await this.loadTheme(includedThemePath, defaultStyle);
|
||||
}
|
||||
|
||||
if (themeContent.colors && themeContent.colors["editor.background"]) {
|
||||
this.editorBackground = themeContent.colors["editor.background"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (textMateRules) {
|
||||
// Convert comma delimited scopes into an array
|
||||
textMateRules.forEach(e => {
|
||||
if (e.scope && e.scope.includes(',')) {
|
||||
e.scope = e.scope.split(',').map((s: string) => s.trim());
|
||||
}
|
||||
});
|
||||
|
||||
let scopelessSetting: any = textMateRules.find(e => e.settings && !e.scope);
|
||||
if (scopelessSetting) {
|
||||
if (scopelessSetting.settings.background) {
|
||||
this.editorBackground = scopelessSetting.settings.background;
|
||||
}
|
||||
this.updateStyleFromTextMateRuleSettings(defaultStyle, scopelessSetting.settings);
|
||||
}
|
||||
rules.push(textMateRules);
|
||||
}
|
||||
}
|
||||
|
||||
return rules;
|
||||
}
|
||||
|
||||
public reload(): void {
|
||||
let f: () => void = async () => {
|
||||
let otherSettings: OtherSettings = new OtherSettings(this.uri);
|
||||
let themeName: string = otherSettings.colorTheme;
|
||||
|
||||
// Enumerate through all extensions, looking for this theme. (Themes are implemented as extensions - even the default ones)
|
||||
// Open each package.json to check for a theme path
|
||||
for (let i: number = 0; i < vscode.extensions.all.length; i++) {
|
||||
let extensionPath: string = vscode.extensions.all[i].extensionPath;
|
||||
let extensionPackageJsonPath: string = path.join(extensionPath, "package.json");
|
||||
if (!await util.checkFileExists(extensionPackageJsonPath)) {
|
||||
continue;
|
||||
}
|
||||
let packageJsonText: string = await util.readFileText(extensionPackageJsonPath);
|
||||
let packageJson: any = jsonc.parse(packageJsonText);
|
||||
if (packageJson.contributes && packageJson.contributes.themes) {
|
||||
let foundTheme: any = packageJson.contributes.themes.find(e => e.id === themeName || e.label === themeName);
|
||||
if (foundTheme) {
|
||||
let themeRelativePath: string = foundTheme.path;
|
||||
let themeFullPath: string = path.join(extensionPath, themeRelativePath);
|
||||
let defaultStyle: ThemeStyle = new ThemeStyle();
|
||||
let rulesSet: TextMateRule[][] = await this.loadTheme(themeFullPath, defaultStyle);
|
||||
this.updateStyles(themeName, defaultStyle, rulesSet);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
this.syncWithLoadingSettings(f);
|
||||
}
|
||||
|
||||
public static createDecorationFromThemeStyle(themeStyle: ThemeStyle): vscode.TextEditorDecorationType {
|
||||
if (themeStyle && (themeStyle.foreground || themeStyle.background || themeStyle.fontStyle)) {
|
||||
let options: vscode.DecorationRenderOptions = {};
|
||||
options.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen;
|
||||
if (themeStyle.foreground) {
|
||||
options.color = themeStyle.foreground;
|
||||
}
|
||||
if (themeStyle.background) {
|
||||
options.backgroundColor = themeStyle.background;
|
||||
}
|
||||
if (themeStyle.fontStyle) {
|
||||
let parts: string[] = themeStyle.fontStyle.split(" ");
|
||||
parts.forEach((part) => {
|
||||
switch (part) {
|
||||
case "italic":
|
||||
options.fontStyle = "italic";
|
||||
break;
|
||||
case "bold":
|
||||
options.fontWeight = "bold";
|
||||
break;
|
||||
case "underline":
|
||||
options.textDecoration = "underline";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
return vscode.window.createTextEditorDecorationType(options);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export class ColorizationState {
|
||||
private uri: vscode.Uri;
|
||||
private colorizationSettings: ColorizationSettings;
|
||||
private decorations: vscode.TextEditorDecorationType[] = new Array<vscode.TextEditorDecorationType>(TokenKind.Count);
|
||||
private semanticRanges: vscode.Range[][] = new Array<vscode.Range[]>(TokenKind.Count);
|
||||
private inactiveDecoration: vscode.TextEditorDecorationType = null;
|
||||
private inactiveRanges: vscode.Range[] = [];
|
||||
private versionedEdits: VersionedEdits[] = [];
|
||||
private currentSemanticVersion: number = 0;
|
||||
private lastReceivedSemanticVersion: number = 0;
|
||||
|
||||
public constructor(uri: vscode.Uri, colorizationSettings: ColorizationSettings) {
|
||||
this.uri = uri;
|
||||
this.colorizationSettings = colorizationSettings;
|
||||
}
|
||||
|
||||
private createColorizationDecorations(isCpp: boolean): void {
|
||||
let settings: CppSettings = new CppSettings(this.uri);
|
||||
if (settings.enhancedColorization) {
|
||||
// Create new decorators
|
||||
// The first decorator created takes precedence, so these need to be created in reverse order
|
||||
for (let i: number = TokenKind.Count; i > 0;) {
|
||||
i--;
|
||||
let themeStyleMap: any;
|
||||
if (isCpp) {
|
||||
themeStyleMap = this.colorizationSettings.themeStyleCppMap;
|
||||
} else {
|
||||
themeStyleMap = this.colorizationSettings.themeStyleCMap;
|
||||
}
|
||||
this.decorations[i] = ColorizationSettings.createDecorationFromThemeStyle(themeStyleMap[i]);
|
||||
}
|
||||
}
|
||||
if (settings.dimInactiveRegions) {
|
||||
this.inactiveDecoration = vscode.window.createTextEditorDecorationType({
|
||||
opacity: settings.inactiveRegionOpacity.toString(),
|
||||
backgroundColor: settings.inactiveRegionBackgroundColor,
|
||||
color: settings.inactiveRegionForegroundColor,
|
||||
rangeBehavior: vscode.DecorationRangeBehavior.OpenOpen
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private disposeColorizationDecorations(): void {
|
||||
// Dispose of all old decorations
|
||||
if (this.inactiveDecoration) {
|
||||
this.inactiveDecoration.dispose();
|
||||
this.inactiveDecoration = null;
|
||||
}
|
||||
for (let i: number = 0; i < TokenKind.Count; i++) {
|
||||
if (this.decorations[i]) {
|
||||
this.decorations[i].dispose();
|
||||
this.decorations[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this.disposeColorizationDecorations();
|
||||
}
|
||||
|
||||
private refreshInner(e: vscode.TextEditor): void {
|
||||
let settings: CppSettings = new CppSettings(this.uri);
|
||||
if (settings.enhancedColorization) {
|
||||
for (let i: number = 0; i < TokenKind.Count; i++) {
|
||||
if (this.decorations[i]) {
|
||||
let ranges: vscode.Range[] = this.semanticRanges[i];
|
||||
if (ranges && ranges.length > 0) {
|
||||
e.setDecorations(this.decorations[i], ranges);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Normally, decorators are honored in the order in which they were created, not the
|
||||
// order in which they were applied. Decorators with opacity appear to be handled
|
||||
// differently, in that the opacity is applied to overlapping decorators even if
|
||||
// created afterwards.
|
||||
if (settings.dimInactiveRegions && this.inactiveDecoration && this.inactiveRanges) {
|
||||
e.setDecorations(this.inactiveDecoration, this.inactiveRanges);
|
||||
}
|
||||
}
|
||||
|
||||
public refresh(e: vscode.TextEditor): void {
|
||||
this.applyEdits();
|
||||
let f: () => void = async () => {
|
||||
this.refreshInner(e);
|
||||
};
|
||||
this.colorizationSettings.syncWithLoadingSettings(f);
|
||||
}
|
||||
|
||||
public onSettingsChanged(uri: vscode.Uri): void {
|
||||
let f: () => void = async () => {
|
||||
this.applyEdits();
|
||||
this.disposeColorizationDecorations();
|
||||
let isCpp: boolean = util.isEditorFileCpp(uri.toString());
|
||||
this.createColorizationDecorations(isCpp);
|
||||
let editors: vscode.TextEditor[] = vscode.window.visibleTextEditors.filter(e => e.document.uri === uri);
|
||||
for (let e of editors) {
|
||||
this.refreshInner(e);
|
||||
}
|
||||
};
|
||||
this.colorizationSettings.syncWithLoadingSettings(f);
|
||||
}
|
||||
|
||||
// Utility function to convert a string and a start Position into a Range
|
||||
private textToRange(text: string, startPosition: vscode.Position): vscode.Range {
|
||||
let parts: string[] = text.split("\n");
|
||||
let addedLines: number = parts.length - 1;
|
||||
let newStartLine: number = startPosition.line;
|
||||
let newStartCharacter: number = startPosition.character;
|
||||
let newEndLine: number = newStartLine + addedLines;
|
||||
let newEndCharacter: number = parts[parts.length - 1].length;
|
||||
if (newStartLine === newEndLine) {
|
||||
newEndCharacter += newStartCharacter;
|
||||
}
|
||||
return new vscode.Range(newStartLine, newStartCharacter, newEndLine, newEndCharacter);
|
||||
}
|
||||
|
||||
// Utility function to shift a range back after removing content before it
|
||||
private shiftRangeAfterRemove(range: vscode.Range, removeStartPosition: vscode.Position, removeEndPosition: vscode.Position): vscode.Range {
|
||||
let lineDelta: number = removeStartPosition.line - removeEndPosition.line;
|
||||
let startCharacterDelta: number = 0;
|
||||
let endCharacterDelta: number = 0;
|
||||
if (range.start.line === removeEndPosition.line) {
|
||||
startCharacterDelta = removeStartPosition.character - removeEndPosition.character;
|
||||
if (range.end.line === removeEndPosition.line) {
|
||||
endCharacterDelta = startCharacterDelta;
|
||||
}
|
||||
}
|
||||
let newStart: vscode.Position = range.start.translate(lineDelta, startCharacterDelta);
|
||||
let newEnd: vscode.Position = range.end.translate(lineDelta, endCharacterDelta);
|
||||
return new vscode.Range(newStart, newEnd);
|
||||
}
|
||||
|
||||
// Utility function to shift a range forward after inserting content before it
|
||||
private shiftRangeAfterInsert(range: vscode.Range, insertStartPosition: vscode.Position, insertEndPosition: vscode.Position): vscode.Range {
|
||||
let addedLines: number = insertEndPosition.line - insertStartPosition.line;
|
||||
let newStartLine: number = range.start.line + addedLines;
|
||||
let newEndLine: number = range.end.line + addedLines;
|
||||
let newStartCharacter: number = range.start.character;
|
||||
let newEndCharacter: number = range.end.character;
|
||||
// If starts on the same line as replacement ended
|
||||
if (insertEndPosition.line === newStartLine) {
|
||||
let endOffsetLength: number = insertEndPosition.character;
|
||||
// If insertRange starts and ends on the same line, only offset by it's length
|
||||
if (insertEndPosition.line === insertStartPosition.line) {
|
||||
endOffsetLength -= insertStartPosition.character;
|
||||
}
|
||||
newStartCharacter += endOffsetLength;
|
||||
if (insertEndPosition.line === newEndLine) {
|
||||
newEndCharacter += endOffsetLength;
|
||||
}
|
||||
}
|
||||
return new vscode.Range(newStartLine, newStartCharacter, newEndLine, newEndCharacter);
|
||||
}
|
||||
|
||||
// Utility function to adjust a range to account for an insert and/or replace
|
||||
private fixRange(range: vscode.Range, removeInsertStartPosition: vscode.Position, removeEndPosition: vscode.Position, insertEndPosition: vscode.Position): vscode.Range {
|
||||
// If the replace/insert starts after this range ends, no adjustment is needed.
|
||||
if (removeInsertStartPosition.isAfterOrEqual(range.end)) {
|
||||
return range;
|
||||
}
|
||||
// Else, replace/insert range starts before this range ends.
|
||||
|
||||
// If replace/insert starts before/where this range starts, we don't need to extend the existing range, but need to shift it
|
||||
if (removeInsertStartPosition.isBeforeOrEqual(range.start)) {
|
||||
|
||||
// If replace consumes the entire range, remove it
|
||||
if (removeEndPosition.isAfterOrEqual(range.end)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// If replace ends within this range, we need to trim it before we shift it
|
||||
let newRange: vscode.Range;
|
||||
if (removeEndPosition.isAfterOrEqual(range.start)) {
|
||||
newRange = new vscode.Range(removeEndPosition, range.end);
|
||||
} else {
|
||||
newRange = range;
|
||||
}
|
||||
// Else, if replace ends before this range starts, we just need to shift it.
|
||||
|
||||
newRange = this.shiftRangeAfterRemove(newRange, removeInsertStartPosition, removeEndPosition);
|
||||
return this.shiftRangeAfterInsert(newRange, removeInsertStartPosition, insertEndPosition);
|
||||
}
|
||||
// Else, if replace/insert starts within (not before or after) range, extend it.
|
||||
|
||||
// If there replace/insert overlaps past the end of the original range, just extend existing range to the insert end position
|
||||
if (removeEndPosition.isAfterOrEqual(range.end)) {
|
||||
return new vscode.Range(range.start.line, range.start.character, insertEndPosition.line, insertEndPosition.character);
|
||||
}
|
||||
// Else, range has some left over at the end, which needs to be shifted after insertEndPosition.
|
||||
|
||||
// If the trailing segment is on the last line replace, we just need to extend by the remaining number of characters
|
||||
if (removeEndPosition.line === range.end.line) {
|
||||
return new vscode.Range(range.start.line, range.start.character, insertEndPosition.line, insertEndPosition.character + (range.end.character - removeEndPosition.character));
|
||||
}
|
||||
// Else, the trailing segment ends on another line, so the character position should remain the same. Just adjust based on added/removed lined.
|
||||
let removedLines: number = removeEndPosition.line - removeInsertStartPosition.line;
|
||||
let addedLines: number = insertEndPosition.line - removeInsertStartPosition.line;
|
||||
let deltaLines: number = addedLines - removedLines;
|
||||
return new vscode.Range(range.start.line, range.start.character, range.end.line + deltaLines, range.end.character);
|
||||
}
|
||||
|
||||
private fixRanges(originalRanges: vscode.Range[], changes: readonly vscode.TextDocumentContentChangeEvent[]): vscode.Range[] {
|
||||
// outer loop needs to be the versioned edits, then changes within that edit, then ranges
|
||||
let ranges: vscode.Range[] = originalRanges;
|
||||
if (ranges && ranges.length > 0) {
|
||||
changes.forEach((change) => {
|
||||
let newRanges: vscode.Range[] = [];
|
||||
let insertRange: vscode.Range = this.textToRange(change.text, change.range.start);
|
||||
for (let i: number = 0; i < ranges.length; i++) {
|
||||
let newRange: vscode.Range = this.fixRange(ranges[i], change.range.start, change.range.end, insertRange.end);
|
||||
if (newRange !== null) {
|
||||
newRanges.push(newRange);
|
||||
}
|
||||
}
|
||||
ranges = newRanges;
|
||||
});
|
||||
}
|
||||
return ranges;
|
||||
}
|
||||
|
||||
// Add edits to be applied when/if cached tokens need to be reapplied.
|
||||
public addEdits(changes: readonly vscode.TextDocumentContentChangeEvent[], editVersion: number): void {
|
||||
let edits: VersionedEdits = {
|
||||
editVersion: editVersion,
|
||||
changes: changes
|
||||
};
|
||||
this.versionedEdits.push(edits);
|
||||
}
|
||||
|
||||
// Apply any pending edits to the currently cached tokens
|
||||
private applyEdits() : void {
|
||||
this.versionedEdits.forEach((edit) => {
|
||||
if (edit.editVersion > this.currentSemanticVersion) {
|
||||
for (let i: number = 0; i < TokenKind.Count; i++) {
|
||||
this.semanticRanges[i] = this.fixRanges(this.semanticRanges[i], edit.changes);
|
||||
}
|
||||
this.inactiveRanges = this.fixRanges(this.inactiveRanges, edit.changes);
|
||||
this.currentSemanticVersion = edit.editVersion;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Remove any edits from the list if we will never receive tokens that old.
|
||||
private purgeOldVersionedEdits(): void {
|
||||
let minVersion: number = this.lastReceivedSemanticVersion;
|
||||
let index: number = this.versionedEdits.findIndex((edit) => edit.editVersion > minVersion);
|
||||
if (index === -1) {
|
||||
this.versionedEdits = [];
|
||||
} else if (index > 0) {
|
||||
this.versionedEdits = this.versionedEdits.slice(index);
|
||||
}
|
||||
}
|
||||
|
||||
private updateColorizationRanges(uri: string): void {
|
||||
let f: () => void = async () => {
|
||||
this.applyEdits();
|
||||
this.purgeOldVersionedEdits();
|
||||
|
||||
// The only way to un-apply decorators is to dispose them.
|
||||
// If we dispose old decorators before applying new decorators, we see a flicker on Mac,
|
||||
// likely due to a race with UI updates. Here we set aside the existing decorators to be
|
||||
// disposed of after the new decorators have been applied, so there is not a gap
|
||||
// in which decorators are not applied.
|
||||
let oldInactiveDecoration: vscode.TextEditorDecorationType = this.inactiveDecoration;
|
||||
let oldDecorations: vscode.TextEditorDecorationType[] = this.decorations;
|
||||
this.inactiveDecoration = null;
|
||||
this.decorations = new Array<vscode.TextEditorDecorationType>(TokenKind.Count);
|
||||
|
||||
let isCpp: boolean = util.isEditorFileCpp(uri);
|
||||
this.createColorizationDecorations(isCpp);
|
||||
|
||||
// Apply the decorations to all *visible* text editors
|
||||
let editors: vscode.TextEditor[] = vscode.window.visibleTextEditors.filter(e => e.document.uri.toString() === uri);
|
||||
for (let e of editors) {
|
||||
this.refreshInner(e);
|
||||
}
|
||||
|
||||
// Dispose of the old decorators only after the new ones have been applied.
|
||||
if (oldInactiveDecoration) {
|
||||
oldInactiveDecoration.dispose();
|
||||
}
|
||||
if (oldDecorations) {
|
||||
for (let i: number = 0; i < TokenKind.Count; i++) {
|
||||
if (oldDecorations[i]) {
|
||||
oldDecorations[i].dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
this.colorizationSettings.syncWithLoadingSettings(f);
|
||||
}
|
||||
|
||||
public updateSemantic(uri: string, semanticRanges: vscode.Range[][], inactiveRanges: vscode.Range[], editVersion: number): void {
|
||||
this.inactiveRanges = inactiveRanges;
|
||||
for (let i: number = 0; i < TokenKind.Count; i++) {
|
||||
this.semanticRanges[i] = semanticRanges[i];
|
||||
}
|
||||
this.currentSemanticVersion = editVersion;
|
||||
this.lastReceivedSemanticVersion = editVersion;
|
||||
this.updateColorizationRanges(uri);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,233 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||
* See 'LICENSE' in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import { CustomConfigurationProvider, Version, SourceFileConfigurationItem, WorkspaceBrowseConfiguration } from 'vscode-cpptools';
|
||||
import { CppSettings } from './settings';
|
||||
|
||||
/**
|
||||
* An interface that is guaranteed to be backward compatible with version 0
|
||||
*/
|
||||
export interface CustomConfigurationProvider1 extends CustomConfigurationProvider {
|
||||
isReady: boolean;
|
||||
readonly isValid: boolean;
|
||||
readonly version: Version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps the incoming CustomConfigurationProvider so that we can treat all of them as if they were the same version (e.g. latest)
|
||||
*/
|
||||
class CustomProviderWrapper implements CustomConfigurationProvider1 {
|
||||
private provider: CustomConfigurationProvider;
|
||||
private _isReady: boolean;
|
||||
private _version: Version;
|
||||
|
||||
constructor(provider: CustomConfigurationProvider, version: Version) {
|
||||
this._isReady = version < Version.v2;
|
||||
this.provider = provider;
|
||||
if (provider.extensionId && version === Version.v0) {
|
||||
version = Version.v1; // provider implemented the new API but is interfacing with the extension using the old API version.
|
||||
}
|
||||
this._version = version;
|
||||
}
|
||||
|
||||
public get isReady(): boolean {
|
||||
return this._isReady;
|
||||
}
|
||||
|
||||
public set isReady(ready: boolean) {
|
||||
this._isReady = ready;
|
||||
}
|
||||
|
||||
public get isValid(): boolean {
|
||||
let valid: boolean = !!(this.provider.name && this.provider.canProvideConfiguration && this.provider.provideConfigurations);
|
||||
if (valid && this._version > Version.v0) {
|
||||
valid = !!(this.provider.extensionId && this.provider.dispose);
|
||||
}
|
||||
if (valid && this._version > Version.v1) {
|
||||
valid = !!(this.provider.canProvideBrowseConfiguration && this.provider.provideBrowseConfiguration);
|
||||
}
|
||||
if (valid && this._version > Version.v2) {
|
||||
valid = !!(this.provider.canProvideBrowseConfigurationsPerFolder && this.provider.provideFolderBrowseConfiguration);
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
public get version(): Version {
|
||||
return this._version;
|
||||
}
|
||||
|
||||
public get name(): string {
|
||||
return this.provider.name;
|
||||
}
|
||||
|
||||
public get extensionId(): string {
|
||||
return this._version === Version.v0 ? this.provider.name : this.provider.extensionId;
|
||||
}
|
||||
|
||||
public canProvideConfiguration(uri: vscode.Uri, token?: vscode.CancellationToken): Thenable<boolean> {
|
||||
return this.provider.canProvideConfiguration(uri, token);
|
||||
}
|
||||
|
||||
public provideConfigurations(uris: vscode.Uri[], token?: vscode.CancellationToken): Thenable<SourceFileConfigurationItem[]> {
|
||||
return this.provider.provideConfigurations(uris, token);
|
||||
}
|
||||
|
||||
public canProvideBrowseConfiguration(token?: vscode.CancellationToken): Thenable<boolean> {
|
||||
return this._version < Version.v2 ? Promise.resolve(false) : this.provider.canProvideBrowseConfiguration(token);
|
||||
}
|
||||
|
||||
public provideBrowseConfiguration(token?: vscode.CancellationToken): Thenable<WorkspaceBrowseConfiguration> {
|
||||
console.assert(this._version >= Version.v2);
|
||||
return this._version < Version.v2 ? Promise.resolve({browsePath: []}) : this.provider.provideBrowseConfiguration(token);
|
||||
}
|
||||
|
||||
public canProvideBrowseConfigurationsPerFolder(token?: vscode.CancellationToken): Thenable<boolean> {
|
||||
return this._version < Version.v3 ? Promise.resolve(false) : this.provider.canProvideBrowseConfigurationsPerFolder(token);
|
||||
}
|
||||
|
||||
public provideFolderBrowseConfiguration(uri: vscode.Uri, token?: vscode.CancellationToken): Thenable<WorkspaceBrowseConfiguration> {
|
||||
console.assert(this._version >= Version.v3);
|
||||
return this._version < Version.v3 ? Promise.resolve({browsePath: []}) : this.provider.provideFolderBrowseConfiguration(uri, token);
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
if (this._version !== Version.v0) {
|
||||
this.provider.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class CustomConfigurationProviderCollection {
|
||||
private providers: Map<string, CustomProviderWrapper> = new Map<string, CustomProviderWrapper>();
|
||||
|
||||
private logProblems(provider: CustomConfigurationProvider, version: Version): void {
|
||||
let missing: string[] = [];
|
||||
if (!provider.name) {
|
||||
missing.push("'name'");
|
||||
}
|
||||
if (version !== Version.v0 && !provider.extensionId) {
|
||||
missing.push("'extensionId'");
|
||||
}
|
||||
if (!provider.canProvideConfiguration) {
|
||||
missing.push("'canProvideConfiguration'");
|
||||
}
|
||||
if (!provider.provideConfigurations) {
|
||||
missing.push("'canProvideConfiguration'");
|
||||
}
|
||||
if (version !== Version.v0 && !provider.dispose) {
|
||||
missing.push("'dispose'");
|
||||
}
|
||||
if (version >= Version.v2 && !provider.canProvideBrowseConfiguration) {
|
||||
missing.push("'canProvideBrowseConfiguration'");
|
||||
}
|
||||
if (version >= Version.v2 && !provider.provideBrowseConfiguration) {
|
||||
missing.push("'provideBrowseConfiguration'");
|
||||
}
|
||||
if (version >= Version.v3 && !provider.canProvideBrowseConfigurationsPerFolder) {
|
||||
missing.push("'canProvideBrowseConfigurationsPerFolder'");
|
||||
}
|
||||
if (version >= Version.v3 && !provider.provideFolderBrowseConfiguration) {
|
||||
missing.push("'provideFolderBrowseConfiguration'");
|
||||
}
|
||||
console.error(`CustomConfigurationProvider was not registered. The following properties are missing from the implementation: ${missing.join(", ")}.`);
|
||||
}
|
||||
|
||||
private getId(provider: string|CustomConfigurationProvider): string {
|
||||
if (typeof provider === "string") {
|
||||
return provider;
|
||||
} else if (provider.extensionId) {
|
||||
return provider.extensionId;
|
||||
} else if (provider.name) {
|
||||
return provider.name;
|
||||
} else {
|
||||
console.error(`invalid provider: ${provider}`);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public get size(): number {
|
||||
return this.providers.size;
|
||||
}
|
||||
|
||||
public add(provider: CustomConfigurationProvider, version: Version): boolean {
|
||||
if (new CppSettings().intelliSenseEngine === "Disabled") {
|
||||
console.warn("IntelliSense is disabled. Provider will not be registered.");
|
||||
return false;
|
||||
}
|
||||
|
||||
let wrapper: CustomProviderWrapper = new CustomProviderWrapper(provider, version);
|
||||
if (!wrapper.isValid) {
|
||||
this.logProblems(provider, version);
|
||||
return false;
|
||||
}
|
||||
|
||||
let exists: boolean = this.providers.has(wrapper.extensionId);
|
||||
if (exists) {
|
||||
let existing: CustomProviderWrapper = this.providers.get(wrapper.extensionId);
|
||||
exists = (existing.version === Version.v0 && wrapper.version === Version.v0);
|
||||
}
|
||||
|
||||
if (!exists) {
|
||||
this.providers.set(wrapper.extensionId, wrapper);
|
||||
} else {
|
||||
console.error(`CustomConfigurationProvider '${wrapper.extensionId}' has already been registered.`);
|
||||
}
|
||||
return !exists;
|
||||
}
|
||||
|
||||
public get(provider: string|CustomConfigurationProvider): CustomConfigurationProvider1|null {
|
||||
let id: string = this.getId(provider);
|
||||
|
||||
if (this.providers.has(id)) {
|
||||
return this.providers.get(id);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public forEach(func: (provider: CustomConfigurationProvider1) => void): void {
|
||||
this.providers.forEach(func);
|
||||
}
|
||||
|
||||
public remove(provider: CustomConfigurationProvider): void {
|
||||
let id: string = this.getId(provider);
|
||||
if (this.providers.has(id)) {
|
||||
this.providers.delete(id);
|
||||
} else {
|
||||
console.warn(`${id} is not registered`);
|
||||
}
|
||||
}
|
||||
|
||||
public checkId(providerId?: string): string {
|
||||
if (!providerId) {
|
||||
return providerId;
|
||||
}
|
||||
let found: CustomConfigurationProvider1[] = [];
|
||||
let noUpdate: boolean = false;
|
||||
this.forEach(provider => {
|
||||
if (provider.extensionId === providerId) {
|
||||
noUpdate = true;
|
||||
} else if (provider.name === providerId && provider.version !== Version.v0) {
|
||||
found.push(provider);
|
||||
}
|
||||
});
|
||||
if (noUpdate) {
|
||||
return providerId;
|
||||
}
|
||||
if (found.length === 1) {
|
||||
return found[0].extensionId;
|
||||
} else if (found.length > 1) {
|
||||
console.warn("duplicate provider name found. Not upgrading.");
|
||||
}
|
||||
return providerId;
|
||||
}
|
||||
}
|
||||
|
||||
let providerCollection: CustomConfigurationProviderCollection = new CustomConfigurationProviderCollection();
|
||||
|
||||
export function getCustomConfigProviders(): CustomConfigurationProviderCollection {
|
||||
return providerCollection;
|
||||
}
|
||||
@@ -44,4 +44,4 @@ export class DataBinding<T> {
|
||||
this.deactivate();
|
||||
this.valueChanged.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -162,7 +162,7 @@ function getMLContinuationRule(comment: CommentPattern): vscode.OnEnterRule | un
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// When Enter is pressed while the cursor is after '*/' (and '*/' plus leading whitespace is all that is on the line)
|
||||
// When Enter is pressed while the cursor is after '*/' (and '*/' plus leading whitespace is all that is on the line)
|
||||
function getMLEndRule(comment: CommentPattern): vscode.OnEnterRule | undefined {
|
||||
if (comment) {
|
||||
let endPattern: string = getMLEndPattern(comment.continue);
|
||||
@@ -318,4 +318,4 @@ function constructCommentRules(comment: CommentPattern, languageId: string): Rul
|
||||
continue: [],
|
||||
end: []
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,32 +12,41 @@ class PersistentStateBase<T> {
|
||||
private key: string;
|
||||
private defaultvalue: T;
|
||||
private state: vscode.Memento;
|
||||
private curvalue: T;
|
||||
|
||||
constructor(key: string, defaultValue: T, state: vscode.Memento) {
|
||||
this.key = key;
|
||||
this.defaultvalue = defaultValue;
|
||||
this.state = state;
|
||||
this.curvalue = defaultValue;
|
||||
}
|
||||
|
||||
public get Value(): T {
|
||||
return this.state.get<T>(this.key, this.defaultvalue);
|
||||
return this.state ? this.state.get<T>(this.key, this.defaultvalue) : this.curvalue;
|
||||
}
|
||||
|
||||
public set Value(newValue: T) {
|
||||
this.state.update(this.key, newValue);
|
||||
if (this.state) {
|
||||
this.state.update(this.key, newValue);
|
||||
}
|
||||
this.curvalue = newValue;
|
||||
}
|
||||
|
||||
public get DefaultValue(): T {
|
||||
return this.defaultvalue;
|
||||
}
|
||||
}
|
||||
|
||||
// Abstraction for global state that persists across activations but is not present in a settings file
|
||||
export class PersistentState<T> extends PersistentStateBase<T> {
|
||||
constructor(key: string, defaultValue: T) {
|
||||
super(key, defaultValue, util.extensionContext.globalState);
|
||||
super(key, defaultValue, util.extensionContext ? util.extensionContext.globalState : null);
|
||||
}
|
||||
}
|
||||
|
||||
export class PersistentWorkspaceState<T> extends PersistentStateBase<T> {
|
||||
constructor(key: string, defaultValue: T) {
|
||||
super(key, defaultValue, util.extensionContext.workspaceState);
|
||||
super(key, defaultValue, util.extensionContext ? util.extensionContext.workspaceState : null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,16 +4,17 @@
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
|
||||
import * as path from 'path';
|
||||
import { TextDocument } from 'vscode';
|
||||
import { Middleware } from 'vscode-languageclient';
|
||||
import { ClientCollection } from './clientCollection';
|
||||
import { Client } from './client';
|
||||
import { provideCustomConfiguration } from './extension';
|
||||
|
||||
export function createProtocolFilter(me: Client, clients: ClientCollection): Middleware {
|
||||
// Disabling lint for invoke handlers
|
||||
/* tslint:disable */
|
||||
let defaultHandler: (data: any, callback: (data: any) => void) => void = (data, callback: (data) => void) => { if (clients.ActiveClient === me) {me.notifyWhenReady(() => callback(data));}};
|
||||
let invoke1 = (a, callback: (a) => any) => { if (clients.ActiveClient === me) { return me.requestWhenReady(() => callback(a)); } return null; };
|
||||
// let invoke1 = (a, callback: (a) => any) => { if (clients.ActiveClient === me) { return me.requestWhenReady(() => callback(a)); } return null; };
|
||||
let invoke2 = (a, b, callback: (a, b) => any) => { if (clients.ActiveClient === me) { return me.requestWhenReady(() => callback(a, b)); } return null; };
|
||||
let invoke3 = (a, b, c, callback: (a, b, c) => any) => { if (clients.ActiveClient === me) { return me.requestWhenReady(() => callback(a, b, c)); } return null; };
|
||||
let invoke4 = (a, b, c, d, callback: (a, b, c, d) => any) => { if (clients.ActiveClient === me) { return me.requestWhenReady(() => callback(a, b, c, d)); } return null; };
|
||||
@@ -24,14 +25,31 @@ export function createProtocolFilter(me: Client, clients: ClientCollection): Mid
|
||||
didOpen: (document, sendMessage) => {
|
||||
if (clients.checkOwnership(me, document)) {
|
||||
me.TrackedDocuments.add(document);
|
||||
provideCustomConfiguration(document, me).then(() => {
|
||||
sendMessage(document);
|
||||
}, () => {
|
||||
sendMessage(document);
|
||||
});
|
||||
|
||||
// Work around vscode treating ".C" as c, by adding this file name to file associations as cpp
|
||||
if (document.uri.path.endsWith(".C")) {
|
||||
let fileName: string = path.basename(document.uri.fsPath);
|
||||
let mappingString: string = fileName + "@" + document.uri.fsPath;
|
||||
me.addFileAssociations(mappingString, false);
|
||||
}
|
||||
|
||||
me.onDidOpenTextDocument(document);
|
||||
|
||||
// 'document' is a reference to the live TextDocument. Because the document can change while we wait for
|
||||
// custom configurations, we must clone the current state of the object before yielding the thread.
|
||||
// Theoretically, we should do this everywhere, but there are no other callbacks that read the document
|
||||
// state directly (just the Uri) so there doesn't appear to be a need to do it.
|
||||
const documentCopy: TextDocument = {...document};
|
||||
me.provideCustomConfiguration(document.uri, null);
|
||||
me.notifyWhenReady(() => sendMessage(documentCopy));
|
||||
}
|
||||
},
|
||||
didChange: (textDocumentChangeEvent, sendMessage) => {
|
||||
if (clients.ActiveClient === me) {
|
||||
me.onDidChangeTextDocument(textDocumentChangeEvent);
|
||||
me.notifyWhenReady(() => sendMessage(textDocumentChangeEvent));
|
||||
}
|
||||
},
|
||||
didChange: defaultHandler,
|
||||
willSave: defaultHandler,
|
||||
willSaveWaitUntil: (event, sendMessage) => {
|
||||
if (clients.ActiveClient === me) {
|
||||
@@ -48,9 +66,14 @@ export function createProtocolFilter(me: Client, clients: ClientCollection): Mid
|
||||
}
|
||||
},
|
||||
|
||||
provideCompletionItem: invoke3,
|
||||
provideCompletionItem: invoke4,
|
||||
resolveCompletionItem: invoke2,
|
||||
provideHover: invoke3,
|
||||
provideHover: (document, position, token, next: (document, position, token) => any) => {
|
||||
if (clients.checkOwnership(me, document)) {
|
||||
return me.requestWhenReady(() => next(document, position, token));
|
||||
}
|
||||
return null;
|
||||
},
|
||||
provideSignatureHelp: invoke3,
|
||||
provideDefinition: invoke3,
|
||||
provideReferences: invoke4,
|
||||
@@ -66,6 +89,7 @@ export function createProtocolFilter(me: Client, clients: ClientCollection): Mid
|
||||
provideRenameEdits: invoke4,
|
||||
provideDocumentLinks: invoke2,
|
||||
resolveDocumentLink: invoke2,
|
||||
provideDeclaration: invoke3
|
||||
|
||||
// I believe the default handler will do the same thing.
|
||||
// workspace: {
|
||||
|
||||
@@ -29,39 +29,64 @@ export class CppSettings extends Settings {
|
||||
constructor(resource?: vscode.Uri) {
|
||||
super("C_Cpp", resource);
|
||||
}
|
||||
|
||||
|
||||
public get clangFormatPath(): string { return super.Section.get<string>("clang_format_path"); }
|
||||
public get clangFormatStyle(): string { return super.Section.get<string>("clang_format_style"); }
|
||||
public get clangFormatFallbackStyle(): string { return super.Section.get<string>("clang_format_fallbackStyle"); }
|
||||
public get clangFormatSortIncludes(): string { return super.Section.get<string>("clang_format_sortIncludes"); }
|
||||
public get clangFormatOnSave(): string { return super.Section.get<string>("clang_format_formatOnSave"); }
|
||||
public get formatting(): string { return super.Section.get<string>("formatting"); }
|
||||
public get experimentalFeatures(): string { return super.Section.get<string>("experimentalFeatures"); }
|
||||
public get suggestSnippets(): boolean { return super.Section.get<boolean>("suggestSnippets"); }
|
||||
public get intelliSenseEngine(): string { return super.Section.get<string>("intelliSenseEngine"); }
|
||||
public get intelliSenseEngineFallback(): string { return super.Section.get<string>("intelliSenseEngineFallback"); }
|
||||
public get intelliSenseCachePath(): string { return super.Section.get<string>("intelliSenseCachePath"); }
|
||||
public get intelliSenseCacheSize(): number { return super.Section.get<number>("intelliSenseCacheSize"); }
|
||||
public get errorSquiggles(): string { return super.Section.get<string>("errorSquiggles"); }
|
||||
public get dimInactiveRegions(): boolean { return super.Section.get<boolean>("dimInactiveRegions"); }
|
||||
public get inactiveRegionOpacity(): number { return super.Section.get<number>("inactiveRegionOpacity"); }
|
||||
public get inactiveRegionForegroundColor(): string { return super.Section.get<string>("inactiveRegionForegroundColor"); }
|
||||
public get inactiveRegionBackgroundColor(): string { return super.Section.get<string>("inactiveRegionBackgroundColor"); }
|
||||
public get autoComplete(): string { return super.Section.get<string>("autocomplete"); }
|
||||
public get loggingLevel(): string { return super.Section.get<string>("loggingLevel"); }
|
||||
public get navigationLength(): number { return super.Section.get<number>("navigation.length", 60); }
|
||||
public get autoAddFileAssociations(): boolean { return super.Section.get<boolean>("autoAddFileAssociations"); }
|
||||
public get workspaceParsingPriority(): boolean { return super.Section.get<boolean>("workspaceParsingPriority"); }
|
||||
public get workspaceSymbols(): string { return super.Section.get<string>("workspaceSymbols"); }
|
||||
public get exclusionPolicy(): boolean { return super.Section.get<boolean>("exclusionPolicy"); }
|
||||
public get commentContinuationPatterns(): (string | CommentPattern)[] { return super.Section.get<(string | CommentPattern)[]>("commentContinuationPatterns"); }
|
||||
public get configurationWarnings(): string { return super.Section.get<string>("configurationWarnings"); }
|
||||
public get preferredPathSeparator(): string { return super.Section.get<string>("preferredPathSeparator"); }
|
||||
public get updateChannel(): string { return super.Section.get<string>("updateChannel"); }
|
||||
public get vcpkgEnabled(): boolean { return super.Section.get<boolean>("vcpkg.enabled"); }
|
||||
public get defaultIncludePath(): string[] { return super.Section.get<string[]>("default.includePath"); }
|
||||
public get defaultDefines(): string[] { return super.Section.get<string[]>("default.defines"); }
|
||||
public get defaultMacFrameworkPath(): string[] { return super.Section.get<string[]>("default.macFrameworkPath"); }
|
||||
public get defaultWindowsSdkVersion(): string { return super.Section.get<string>("default.windowsSdkVersion"); }
|
||||
public get defaultCompileCommands(): string { return super.Section.get<string>("default.compileCommands"); }
|
||||
public get defaultForcedInclude(): string[] { return super.Section.get<string[]>("default.forcedInclude"); }
|
||||
public get defaultIntelliSenseMode(): string { return super.Section.get<string>("default.intelliSenseMode"); }
|
||||
public get defaultCompilerPath(): string { return super.Section.get<string>("default.compilerPath"); }
|
||||
public get defaultCompilerArgs(): string[] { return super.Section.get<string[]>("default.compilerArgs"); }
|
||||
public get defaultCStandard(): string { return super.Section.get<string>("default.cStandard"); }
|
||||
public get defaultCppStandard(): string { return super.Section.get<string>("default.cppStandard"); }
|
||||
public get defaultConfigurationProvider(): string { return super.Section.get<string>("default.configurationProvider"); }
|
||||
public get defaultBrowsePath(): string[] { return super.Section.get<string[]>("default.browse.path"); }
|
||||
public get defaultDatabaseFilename(): string { return super.Section.get<string>("default.browse.databaseFilename"); }
|
||||
public get defaultLimitSymbolsToIncludedHeaders(): boolean { return super.Section.get<boolean>("default.browse.limitSymbolsToIncludedHeaders"); }
|
||||
public get defaultSystemIncludePath(): string[] { return super.Section.get<string[]>("default.systemIncludePath"); }
|
||||
public get defaultEnableConfigurationSquiggles(): boolean { return super.Section.get<boolean>("default.enableConfigurationSquiggles"); }
|
||||
|
||||
public get enhancedColorization(): boolean {
|
||||
return super.Section.get<string>("enhancedColorization") === "Enabled"
|
||||
&& super.Section.get<string>("intelliSenseEngine") === "Default"
|
||||
&& vscode.workspace.getConfiguration("workbench").get<string>("colorTheme") !== "Default High Contrast";
|
||||
}
|
||||
|
||||
public get dimInactiveRegions(): boolean {
|
||||
return super.Section.get<boolean>("dimInactiveRegions")
|
||||
&& super.Section.get<string>("intelliSenseEngine") === "Default"
|
||||
&& vscode.workspace.getConfiguration("workbench").get<string>("colorTheme") !== "Default High Contrast";
|
||||
}
|
||||
|
||||
public toggleSetting(name: string, value1: string, value2: string): void {
|
||||
let value: string = super.Section.get<string>(name);
|
||||
@@ -72,6 +97,17 @@ export class CppSettings extends Settings {
|
||||
}
|
||||
}
|
||||
|
||||
export interface TextMateRuleSettings {
|
||||
foreground: string | undefined;
|
||||
background: string | undefined;
|
||||
fontStyle: string | undefined;
|
||||
}
|
||||
|
||||
export interface TextMateRule {
|
||||
scope: any;
|
||||
settings: TextMateRuleSettings;
|
||||
}
|
||||
|
||||
export class OtherSettings {
|
||||
private resource: vscode.Uri;
|
||||
|
||||
@@ -82,12 +118,20 @@ export class OtherSettings {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
public get editorTabSize(): vscode.WorkspaceConfiguration { return vscode.workspace.getConfiguration("editor", this.resource).get("tabSize"); }
|
||||
public get editorTabSize(): number { return vscode.workspace.getConfiguration("editor", this.resource).get<number>("tabSize"); }
|
||||
public get filesAssociations(): any { return vscode.workspace.getConfiguration("files", null).get("associations"); }
|
||||
public set filesAssociations(value: any) {
|
||||
vscode.workspace.getConfiguration("files", null).update("associations", value, vscode.ConfigurationTarget.Workspace);
|
||||
}
|
||||
public get filesExclude(): vscode.WorkspaceConfiguration { return vscode.workspace.getConfiguration("files", this.resource).get("exclude"); }
|
||||
public get searchExclude(): vscode.WorkspaceConfiguration { return vscode.workspace.getConfiguration("search", this.resource).get("exclude"); }
|
||||
public get settingsEditor(): string { return vscode.workspace.getConfiguration("workbench.settings").get<string>("editor"); }
|
||||
|
||||
public set filesAssociations(value: any) {
|
||||
vscode.workspace.getConfiguration("files", null).update("associations", value, vscode.ConfigurationTarget.Workspace);
|
||||
}
|
||||
}
|
||||
public get colorTheme(): string { return vscode.workspace.getConfiguration("workbench").get<string>("colorTheme"); }
|
||||
|
||||
public getCustomColorToken(colorTokenName: string): string { return vscode.workspace.getConfiguration("editor.tokenColorCustomizations").get<string>(colorTokenName); }
|
||||
public getCustomThemeSpecificColorToken(themeName: string, colorTokenName: string): string { return vscode.workspace.getConfiguration(`editor.tokenColorCustomizations.[${themeName}]`, this.resource).get<string>(colorTokenName); }
|
||||
|
||||
public get customTextMateRules(): TextMateRule[] { return vscode.workspace.getConfiguration("editor.tokenColorCustomizations").get<TextMateRule[]>("textMateRules"); }
|
||||
public getCustomThemeSpecificTextMateRules(themeName: string): TextMateRule[] { return vscode.workspace.getConfiguration(`editor.tokenColorCustomizations.[${themeName}]`, this.resource).get<TextMateRule[]>("textMateRules"); }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,380 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||
* See 'LICENSE' in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
import * as vscode from 'vscode';
|
||||
import * as util from '../common';
|
||||
import * as config from './configurations';
|
||||
import * as telemetry from '../telemetry';
|
||||
|
||||
// TODO: share ElementId between SettingsPanel and SettingsApp. Investigate why SettingsApp cannot import/export
|
||||
const elementId: { [key: string]: string } = {
|
||||
// Basic settings
|
||||
configName: "configName",
|
||||
configSelection: "configSelection",
|
||||
addConfigBtn: "addConfigBtn",
|
||||
addConfigOk: "addConfigOk",
|
||||
addConfigCancel: "addConfigCancel",
|
||||
addConfigName: "addConfigName",
|
||||
|
||||
compilerPath: "compilerPath",
|
||||
compilerPathInvalid: "compilerPathInvalid",
|
||||
knownCompilers: "knownCompilers",
|
||||
compilerArgs: "compilerArgs",
|
||||
|
||||
intelliSenseMode: "intelliSenseMode",
|
||||
intelliSenseModeInvalid: "intelliSenseModeInvalid",
|
||||
includePath: "includePath",
|
||||
includePathInvalid: "includePathInvalid",
|
||||
defines: "defines",
|
||||
cStandard: "cStandard",
|
||||
cppStandard: "cppStandard",
|
||||
|
||||
// Advanced settings
|
||||
windowsSdkVersion: "windowsSdkVersion",
|
||||
macFrameworkPath: "macFrameworkPath",
|
||||
compileCommands: "compileCommands",
|
||||
configurationProvider: "configurationProvider",
|
||||
forcedInclude: "forcedInclude",
|
||||
|
||||
// Browse properties
|
||||
browsePath: "browsePath",
|
||||
limitSymbolsToIncludedHeaders: "limitSymbolsToIncludedHeaders",
|
||||
databaseFilename: "databaseFilename",
|
||||
|
||||
// Other
|
||||
showAdvancedBtn: "showAdvancedBtn"
|
||||
};
|
||||
|
||||
export class SettingsPanel {
|
||||
private telemetry: { [key: string]: number } = {};
|
||||
private disposable: vscode.Disposable = undefined;
|
||||
|
||||
// Events
|
||||
private settingsPanelActivated = new vscode.EventEmitter<void>();
|
||||
private configValuesChanged = new vscode.EventEmitter<void>();
|
||||
private configSelectionChanged = new vscode.EventEmitter<void>();
|
||||
private addConfigRequested = new vscode.EventEmitter<string>();
|
||||
|
||||
// Configuration data
|
||||
private configValues: config.Configuration;
|
||||
private isIntelliSenseModeDefined: boolean = false;
|
||||
private configIndexSelected: number = 0;
|
||||
private compilerPaths: string[] = [];
|
||||
|
||||
// WebviewPanel objects
|
||||
private panel: vscode.WebviewPanel;
|
||||
private disposablesPanel: vscode.Disposable = undefined;
|
||||
private static readonly viewType: string = 'settingsPanel';
|
||||
private static readonly title: string = 'C/C++ Configurations';
|
||||
|
||||
constructor() {
|
||||
this.configValues = { name: undefined };
|
||||
this.disposable = vscode.Disposable.from(
|
||||
this.settingsPanelActivated,
|
||||
this.configValuesChanged,
|
||||
this.configSelectionChanged,
|
||||
this.addConfigRequested
|
||||
);
|
||||
}
|
||||
|
||||
public createOrShow(configSelection: string[], activeConfiguration: config.Configuration, errors: config.ConfigurationErrors): void {
|
||||
const column: vscode.ViewColumn = vscode.window.activeTextEditor
|
||||
? vscode.window.activeTextEditor.viewColumn
|
||||
: undefined;
|
||||
|
||||
// Show existing panel
|
||||
if (this.panel) {
|
||||
this.panel.reveal(column, false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Create new panel
|
||||
this.panel = vscode.window.createWebviewPanel(
|
||||
SettingsPanel.viewType,
|
||||
SettingsPanel.title,
|
||||
column || vscode.ViewColumn.One,
|
||||
{
|
||||
enableCommandUris: true,
|
||||
enableScripts: true,
|
||||
|
||||
// Restrict the webview to only loading content from these directories
|
||||
localResourceRoots: [
|
||||
vscode.Uri.file(util.extensionPath),
|
||||
vscode.Uri.file(path.join(util.extensionPath, 'ui')),
|
||||
vscode.Uri.file(path.join(util.extensionPath, 'out', 'ui'))]
|
||||
}
|
||||
);
|
||||
|
||||
this.panel.iconPath = vscode.Uri.file(util.getExtensionFilePath("LanguageCCPP_color_128x.png"));
|
||||
|
||||
this.disposablesPanel = vscode.Disposable.from(
|
||||
this.panel,
|
||||
this.panel.onDidDispose(this.onPanelDisposed, this),
|
||||
this.panel.onDidChangeViewState(this.onViewStateChanged, this),
|
||||
this.panel.webview.onDidReceiveMessage(this.onMessageReceived, this),
|
||||
vscode.window.onDidChangeWindowState(this.onWindowStateChanged, this)
|
||||
);
|
||||
|
||||
this.panel.webview.html = this.getHtml();
|
||||
|
||||
this.updateWebview(configSelection, activeConfiguration, errors);
|
||||
}
|
||||
|
||||
public get SettingsPanelActivated(): vscode.Event<void> {
|
||||
return this.settingsPanelActivated.event;
|
||||
}
|
||||
|
||||
public get ConfigValuesChanged(): vscode.Event<void> {
|
||||
return this.configValuesChanged.event;
|
||||
}
|
||||
|
||||
public get ConfigSelectionChanged(): vscode.Event<void> {
|
||||
return this.configSelectionChanged.event;
|
||||
}
|
||||
|
||||
public get AddConfigRequested(): vscode.Event<string> {
|
||||
return this.addConfigRequested.event;
|
||||
}
|
||||
|
||||
public get selectedConfigIndex(): number {
|
||||
return this.configIndexSelected;
|
||||
}
|
||||
|
||||
public set selectedConfigIndex(index: number) {
|
||||
this.configIndexSelected = index;
|
||||
}
|
||||
|
||||
public getLastValuesFromConfigUI(): config.Configuration {
|
||||
return this.configValues;
|
||||
}
|
||||
|
||||
public updateConfigUI(configSelection: string[], configuration: config.Configuration, errors: config.ConfigurationErrors|null): void {
|
||||
if (this.panel) {
|
||||
this.updateWebview(configSelection, configuration, errors);
|
||||
}
|
||||
}
|
||||
|
||||
public setKnownCompilers(knownCompilers: config.KnownCompiler[], pathSeparator: string): void {
|
||||
if (knownCompilers && knownCompilers.length) {
|
||||
for (let compiler of knownCompilers) {
|
||||
// Normalize path separators.
|
||||
let path: string = compiler.path;
|
||||
if (pathSeparator === "Forward Slash") {
|
||||
path = path.replace(/\\/g, '/');
|
||||
} else {
|
||||
path = path.replace(/\//g, '\\');
|
||||
}
|
||||
// Do not add duplicate paths in case the default compilers for cpp and c are the same.
|
||||
if (this.compilerPaths.indexOf(path) === -1) {
|
||||
this.compilerPaths.push(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public updateErrors(errors: config.ConfigurationErrors): void {
|
||||
if (this.panel) {
|
||||
this.panel.webview.postMessage({ command: 'updateErrors', errors: errors});
|
||||
}
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
// Log any telemetry
|
||||
if (Object.keys(this.telemetry).length) {
|
||||
telemetry.logLanguageServerEvent("ConfigUI", null, this.telemetry);
|
||||
}
|
||||
|
||||
// Clean up resources
|
||||
this.panel.dispose();
|
||||
|
||||
if (this.disposable) {
|
||||
this.disposable.dispose();
|
||||
}
|
||||
|
||||
if (this.disposablesPanel) {
|
||||
this.disposablesPanel.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private onPanelDisposed(): void {
|
||||
if (this.disposablesPanel) {
|
||||
this.disposablesPanel.dispose();
|
||||
this.panel = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
private updateWebview(configSelection: string[], configuration: config.Configuration, errors: config.ConfigurationErrors|null): void {
|
||||
this.configValues = {...configuration}; // Copy configuration values
|
||||
this.isIntelliSenseModeDefined = (this.configValues.intelliSenseMode !== undefined);
|
||||
if (this.panel) {
|
||||
this.panel.webview.postMessage({ command: 'setKnownCompilers', compilers: this.compilerPaths });
|
||||
this.panel.webview.postMessage({ command: 'updateConfigSelection', selections: configSelection, selectedIndex: this.configIndexSelected });
|
||||
this.panel.webview.postMessage({ command: 'updateConfig', config: this.configValues });
|
||||
if (errors !== null) {
|
||||
this.panel.webview.postMessage({ command: 'updateErrors', errors: errors });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private onViewStateChanged(e: vscode.WebviewPanelOnDidChangeViewStateEvent): void {
|
||||
if (e.webviewPanel.active) {
|
||||
this.settingsPanelActivated.fire();
|
||||
}
|
||||
}
|
||||
|
||||
private onWindowStateChanged(e: vscode.WindowState): void {
|
||||
if (e.focused) {
|
||||
this.settingsPanelActivated.fire();
|
||||
}
|
||||
}
|
||||
|
||||
private onMessageReceived(message: any): void {
|
||||
if (message === null) {
|
||||
return;
|
||||
}
|
||||
switch (message.command) {
|
||||
case 'change':
|
||||
this.updateConfig(message);
|
||||
break;
|
||||
case 'configSelect':
|
||||
this.configSelect(message.index);
|
||||
break;
|
||||
case 'addConfig':
|
||||
this.addConfig(message.name);
|
||||
break;
|
||||
case 'knownCompilerSelect':
|
||||
this.knownCompilerSelect();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private addConfig(name: string): void {
|
||||
this.addConfigRequested.fire(name);
|
||||
this.logTelemetryForElement(elementId.addConfigName);
|
||||
}
|
||||
|
||||
private configSelect(index: number): void {
|
||||
this.configIndexSelected = index;
|
||||
this.configSelectionChanged.fire();
|
||||
this.logTelemetryForElement(elementId.configSelection);
|
||||
}
|
||||
|
||||
private knownCompilerSelect(): void {
|
||||
this.logTelemetryForElement(elementId.knownCompilers);
|
||||
// Remove one count from compilerPath because selecting a different compiler causes a change on the compiler path
|
||||
if (this.telemetry[elementId.compilerPath]) {
|
||||
this.telemetry[elementId.compilerPath]--;
|
||||
}
|
||||
}
|
||||
|
||||
private updateConfig(message: any): void {
|
||||
let splitEntries: (input: any) => string[] = (input: any) => {
|
||||
return input.split("\n").filter((e: string) => e);
|
||||
};
|
||||
|
||||
switch (message.key) {
|
||||
case elementId.configName:
|
||||
this.configValues.name = message.value;
|
||||
break;
|
||||
case elementId.compilerPath:
|
||||
this.configValues.compilerPath = message.value;
|
||||
break;
|
||||
case elementId.compilerArgs:
|
||||
this.configValues.compilerArgs = splitEntries(message.value);
|
||||
break;
|
||||
case elementId.includePath:
|
||||
this.configValues.includePath = splitEntries(message.value);
|
||||
break;
|
||||
case elementId.defines:
|
||||
this.configValues.defines = splitEntries(message.value);
|
||||
break;
|
||||
case elementId.intelliSenseMode:
|
||||
if (message.value !== "${default}" || this.isIntelliSenseModeDefined) {
|
||||
this.configValues.intelliSenseMode = message.value;
|
||||
} else {
|
||||
this.configValues.intelliSenseMode = undefined;
|
||||
}
|
||||
break;
|
||||
case elementId.cStandard:
|
||||
this.configValues.cStandard = message.value;
|
||||
break;
|
||||
case elementId.cppStandard:
|
||||
this.configValues.cppStandard = message.value;
|
||||
break;
|
||||
case elementId.windowsSdkVersion:
|
||||
this.configValues.windowsSdkVersion = message.value;
|
||||
break;
|
||||
case elementId.macFrameworkPath:
|
||||
this.configValues.macFrameworkPath = splitEntries(message.value);
|
||||
break;
|
||||
case elementId.compileCommands:
|
||||
this.configValues.compileCommands = message.value;
|
||||
break;
|
||||
case elementId.configurationProvider:
|
||||
this.configValues.configurationProvider = message.value;
|
||||
break;
|
||||
case elementId.forcedInclude:
|
||||
this.configValues.forcedInclude = splitEntries(message.value);
|
||||
break;
|
||||
case elementId.browsePath:
|
||||
this.initializeBrowseProperties();
|
||||
this.configValues.browse.path = splitEntries(message.value);
|
||||
break;
|
||||
case elementId.limitSymbolsToIncludedHeaders:
|
||||
this.initializeBrowseProperties();
|
||||
this.configValues.browse.limitSymbolsToIncludedHeaders = message.value;
|
||||
break;
|
||||
case elementId.databaseFilename:
|
||||
this.initializeBrowseProperties();
|
||||
this.configValues.browse.databaseFilename = message.value;
|
||||
break;
|
||||
}
|
||||
|
||||
this.configValuesChanged.fire();
|
||||
this.logTelemetryForElement(message.key);
|
||||
}
|
||||
|
||||
private logTelemetryForElement(elementId: string): void {
|
||||
if (this.telemetry[elementId] === undefined) {
|
||||
this.telemetry[elementId] = 0;
|
||||
}
|
||||
this.telemetry[elementId]++;
|
||||
}
|
||||
|
||||
private initializeBrowseProperties(): void {
|
||||
if (this.configValues.browse === undefined) {
|
||||
this.configValues.browse = {};
|
||||
}
|
||||
}
|
||||
|
||||
private getHtml(): string {
|
||||
let content: string | undefined;
|
||||
content = fs.readFileSync(util.getExtensionFilePath("ui/settings.html")).toString();
|
||||
|
||||
content = content.replace(
|
||||
/{{root}}/g,
|
||||
vscode.Uri.file(util.extensionPath)
|
||||
.with({ scheme: 'vscode-resource' })
|
||||
.toString());
|
||||
|
||||
content = content.replace(
|
||||
/{{nonce}}/g,
|
||||
this.getNonce());
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
private getNonce(): string {
|
||||
let nonce: string;
|
||||
const possible: string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
for (let i: number = 0; i < 32; i++) {
|
||||
nonce += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
}
|
||||
return nonce;
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ type FilterFunction = (key: string, val: string, settings: vscode.WorkspaceConfi
|
||||
type KeyValuePair = { key: string; value: string };
|
||||
|
||||
const maxSettingLengthForTelemetry: number = 50;
|
||||
let cache: SettingsTracker = undefined;
|
||||
let cache: SettingsTracker;
|
||||
|
||||
export class SettingsTracker {
|
||||
private previousCppSettings: { [key: string]: any } = {};
|
||||
@@ -160,7 +160,7 @@ export class SettingsTracker {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
if (key === "clang_format_path" || key.startsWith("default.")) {
|
||||
if (key === "clang_format_path" || key === "intelliSenseCachePath" || key.startsWith("default.")) {
|
||||
value = this.areEqual(val, settings.inspect(key).defaultValue) ? "<default>" : "..."; // Track whether it's being used, but nothing specific about it.
|
||||
} else {
|
||||
value = String(this.previousCppSettings[key]);
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
'use strict';
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import { Client } from './client';
|
||||
import { Client, ReferencesCommandMode, referencesCommandModeToString } from './client';
|
||||
import { getCustomConfigProviders, CustomConfigurationProviderCollection } from './customProviders';
|
||||
|
||||
let ui: UI;
|
||||
|
||||
@@ -16,11 +17,26 @@ interface KeyedQuickPickItem extends vscode.QuickPickItem {
|
||||
key: string;
|
||||
}
|
||||
|
||||
// Higher numbers mean greater priority.
|
||||
enum ConfigurationPriority {
|
||||
IncludePath = 1,
|
||||
CompileCommands = 2,
|
||||
CustomProvider = 3,
|
||||
}
|
||||
|
||||
interface ConfigurationResult {
|
||||
configured: boolean;
|
||||
priority: ConfigurationPriority;
|
||||
}
|
||||
|
||||
export class UI {
|
||||
private navigationStatusBarItem: vscode.StatusBarItem;
|
||||
private configStatusBarItem: vscode.StatusBarItem;
|
||||
private browseEngineStatusBarItem: vscode.StatusBarItem;
|
||||
private intelliSenseStatusBarItem: vscode.StatusBarItem;
|
||||
private referencesStatusBarItem: vscode.StatusBarItem;
|
||||
private configurationUIPromise: Thenable<ConfigurationResult>;
|
||||
private readonly referencesPreviewTooltip: string = " (click to preview results)";
|
||||
|
||||
constructor() {
|
||||
// 1000 = priority, it needs to be high enough to be on the left of the Ln/Col.
|
||||
@@ -29,11 +45,18 @@ export class UI {
|
||||
this.navigationStatusBarItem.command = "C_Cpp.Navigate";
|
||||
this.ShowNavigation = true;
|
||||
|
||||
this.configStatusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 2);
|
||||
this.configStatusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 3);
|
||||
this.configStatusBarItem.command = "C_Cpp.ConfigurationSelect";
|
||||
this.configStatusBarItem.tooltip = "C/C++ Configuration";
|
||||
this.ShowConfiguration = true;
|
||||
|
||||
this.referencesStatusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 2);
|
||||
this.referencesStatusBarItem.text = "";
|
||||
this.referencesStatusBarItem.tooltip = "";
|
||||
this.referencesStatusBarItem.color = new vscode.ThemeColor("statusBar.foreground");
|
||||
this.referencesStatusBarItem.command = "C_Cpp.ShowReferencesProgress";
|
||||
this.ShowReferencesIcon = true;
|
||||
|
||||
this.intelliSenseStatusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 1);
|
||||
this.intelliSenseStatusBarItem.text = "";
|
||||
this.intelliSenseStatusBarItem.tooltip = "Updating IntelliSense...";
|
||||
@@ -71,11 +94,28 @@ export class UI {
|
||||
private get IsUpdatingIntelliSense(): boolean {
|
||||
return this.intelliSenseStatusBarItem.text !== "";
|
||||
}
|
||||
|
||||
private set IsUpdatingIntelliSense(val: boolean) {
|
||||
this.intelliSenseStatusBarItem.text = val ? "$(flame)" : "";
|
||||
this.ShowFlameIcon = val;
|
||||
}
|
||||
|
||||
private get ReferencesCommand(): ReferencesCommandMode {
|
||||
return this.referencesStatusBarItem.tooltip === "" ? ReferencesCommandMode.None :
|
||||
(this.referencesStatusBarItem.tooltip === referencesCommandModeToString(ReferencesCommandMode.Peek) ? ReferencesCommandMode.Peek : ReferencesCommandMode.Find);
|
||||
}
|
||||
|
||||
private set ReferencesCommand(val: ReferencesCommandMode) {
|
||||
if (val === ReferencesCommandMode.None) {
|
||||
this.referencesStatusBarItem.text = "";
|
||||
this.ShowReferencesIcon = false;
|
||||
} else {
|
||||
this.referencesStatusBarItem.text = "$(search)";
|
||||
this.referencesStatusBarItem.tooltip = referencesCommandModeToString(val) + (val === ReferencesCommandMode.Find ? this.referencesPreviewTooltip : "");
|
||||
this.ShowReferencesIcon = true;
|
||||
}
|
||||
}
|
||||
|
||||
private set ShowNavigation(show: boolean) {
|
||||
if (show) {
|
||||
this.navigationStatusBarItem.show();
|
||||
@@ -100,6 +140,14 @@ export class UI {
|
||||
}
|
||||
}
|
||||
|
||||
private set ShowReferencesIcon(show: boolean) {
|
||||
if (show && this.ReferencesCommand !== ReferencesCommandMode.None) {
|
||||
this.referencesStatusBarItem.show();
|
||||
} else {
|
||||
this.referencesStatusBarItem.hide();
|
||||
}
|
||||
}
|
||||
|
||||
private set ShowConfiguration(show: boolean) {
|
||||
if (show) {
|
||||
this.configStatusBarItem.show();
|
||||
@@ -116,14 +164,13 @@ export class UI {
|
||||
let isSettingsJson: boolean = (activeEditor && (activeEditor.document.fileName.endsWith("c_cpp_properties.json") || activeEditor.document.fileName.endsWith("settings.json")));
|
||||
|
||||
this.ShowConfiguration = isCpp || isSettingsJson;
|
||||
this.ShowDBIcon = isCpp || isSettingsJson;
|
||||
this.ShowFlameIcon = isCpp || isSettingsJson;
|
||||
this.ShowNavigation = isCpp;
|
||||
}
|
||||
|
||||
public bind(client: Client): void {
|
||||
client.TagParsingChanged(value => { this.IsTagParsing = value; });
|
||||
client.IntelliSenseParsingChanged(value => { this.IsUpdatingIntelliSense = value; });
|
||||
client.ReferencesCommandModeChanged(value => { this.ReferencesCommand = value; });
|
||||
client.NavigationLocationChanged(value => { this.NavigationLocation = value; });
|
||||
client.TagParserStatusChanged(value => { this.TagParseStatus = value; });
|
||||
client.ActiveConfigChanged(value => { this.ActiveConfig = value; });
|
||||
@@ -157,15 +204,30 @@ export class UI {
|
||||
for (let i: number = 0; i < configurationNames.length; i++) {
|
||||
items.push({ label: configurationNames[i], description: "", index: i });
|
||||
}
|
||||
items.push({ label: "Edit Configurations...", description: "", index: configurationNames.length });
|
||||
items.push({ label: "Edit Configurations (UI)", description: "", index: configurationNames.length });
|
||||
items.push({ label: "Edit Configurations (JSON)", description: "", index: configurationNames.length + 1 });
|
||||
|
||||
return vscode.window.showQuickPick(items, options)
|
||||
.then(selection => {
|
||||
if (!selection) {
|
||||
return -1;
|
||||
}
|
||||
return selection.index;
|
||||
});
|
||||
.then(selection => (selection) ? selection.index : -1);
|
||||
}
|
||||
|
||||
public showConfigurationProviders(currentProvider: string|null): Thenable<string|undefined> {
|
||||
let options: vscode.QuickPickOptions = {};
|
||||
options.placeHolder = "Select a Configuration Provider...";
|
||||
let providers: CustomConfigurationProviderCollection = getCustomConfigProviders();
|
||||
|
||||
let items: KeyedQuickPickItem[] = [];
|
||||
providers.forEach(provider => {
|
||||
let label: string = provider.name;
|
||||
if (provider.extensionId === currentProvider) {
|
||||
label += " (active)";
|
||||
}
|
||||
items.push({ label: label, description: "", key: provider.extensionId });
|
||||
});
|
||||
items.push({ label: "(none)", description: "Disable the active configuration provider, if applicable.", key: "" });
|
||||
|
||||
return vscode.window.showQuickPick(items, options)
|
||||
.then(selection => (selection) ? selection.key : undefined);
|
||||
}
|
||||
|
||||
public showCompileCommands(paths: string[]): Thenable<number> {
|
||||
@@ -178,12 +240,7 @@ export class UI {
|
||||
}
|
||||
|
||||
return vscode.window.showQuickPick(items, options)
|
||||
.then(selection => {
|
||||
if (!selection) {
|
||||
return -1;
|
||||
}
|
||||
return selection.index;
|
||||
});
|
||||
.then(selection => (selection) ? selection.index : -1);
|
||||
}
|
||||
|
||||
public showWorkspaces(workspaceNames: { name: string; key: string }[]): Thenable<string> {
|
||||
@@ -194,12 +251,7 @@ export class UI {
|
||||
workspaceNames.forEach(name => items.push({ label: name.name, description: "", key: name.key }));
|
||||
|
||||
return vscode.window.showQuickPick(items, options)
|
||||
.then(selection => {
|
||||
if (!selection) {
|
||||
return "";
|
||||
}
|
||||
return selection.key;
|
||||
});
|
||||
.then(selection => (selection) ? selection.key : "");
|
||||
}
|
||||
|
||||
public showParsingCommands(): Thenable<number> {
|
||||
@@ -213,20 +265,59 @@ export class UI {
|
||||
} else {
|
||||
items.push({ label: "Pause Parsing", description: "", index: 0 });
|
||||
}
|
||||
|
||||
|
||||
return vscode.window.showQuickPick(items, options)
|
||||
.then(selection => {
|
||||
if (!selection) {
|
||||
return -1;
|
||||
}
|
||||
return selection.index;
|
||||
.then(selection => (selection) ? selection.index : -1);
|
||||
}
|
||||
|
||||
public showConfigureIncludePathMessage(prompt: () => Thenable<boolean>, onSkip: () => void): void {
|
||||
setTimeout(() => {
|
||||
this.showConfigurationPrompt(ConfigurationPriority.IncludePath, prompt, onSkip);
|
||||
}, 10000);
|
||||
}
|
||||
|
||||
public showConfigureCompileCommandsMessage(prompt: () => Thenable<boolean>, onSkip: () => void): void {
|
||||
setTimeout(() => {
|
||||
this.showConfigurationPrompt(ConfigurationPriority.CompileCommands, prompt, onSkip);
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
public showConfigureCustomProviderMessage(prompt: () => Thenable<boolean>, onSkip: () => void): void {
|
||||
this.showConfigurationPrompt(ConfigurationPriority.CustomProvider, prompt, onSkip);
|
||||
}
|
||||
|
||||
private showConfigurationPrompt(priority: ConfigurationPriority, prompt: () => Thenable<boolean>, onSkip: () => void): void {
|
||||
let showPrompt: () => Thenable<ConfigurationResult> = async () => {
|
||||
let configured: boolean = await prompt();
|
||||
return Promise.resolve({
|
||||
priority: priority,
|
||||
configured: configured
|
||||
});
|
||||
};
|
||||
|
||||
if (this.configurationUIPromise) {
|
||||
this.configurationUIPromise = this.configurationUIPromise.then(result => {
|
||||
if (priority > result.priority) {
|
||||
return showPrompt();
|
||||
} else if (!result.configured) {
|
||||
return showPrompt();
|
||||
}
|
||||
onSkip();
|
||||
return Promise.resolve({
|
||||
priority: result.priority,
|
||||
configured: true
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.configurationUIPromise = showPrompt();
|
||||
}
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this.configStatusBarItem.dispose();
|
||||
this.browseEngineStatusBarItem.dispose();
|
||||
this.intelliSenseStatusBarItem.dispose();
|
||||
this.referencesStatusBarItem.dispose();
|
||||
this.navigationStatusBarItem.dispose();
|
||||
}
|
||||
}
|
||||
@@ -236,4 +327,4 @@ export function getUI(): UI {
|
||||
ui = new UI();
|
||||
}
|
||||
return ui;
|
||||
}
|
||||
}
|
||||
|
||||
+38
-61
@@ -4,15 +4,10 @@
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
|
||||
import * as url from 'url';
|
||||
import * as https from 'https';
|
||||
import { ClientRequest } from 'http';
|
||||
import * as vscode from 'vscode';
|
||||
import * as fs from 'fs';
|
||||
|
||||
import * as util from './common';
|
||||
import * as Telemetry from './telemetry';
|
||||
import { PersistentState } from './LanguageServer/persistentState';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const userBucketMax: number = 100;
|
||||
const userBucketString: string = "CPP.UserBucket";
|
||||
@@ -21,61 +16,76 @@ const localConfigFile: string = "cpptools.json";
|
||||
interface Settings {
|
||||
defaultIntelliSenseEngine?: number;
|
||||
recursiveIncludes?: number;
|
||||
gotoDefIntelliSense?: number;
|
||||
enhancedColorization?: number;
|
||||
}
|
||||
|
||||
export class ABTestSettings {
|
||||
private settings: Settings;
|
||||
private intelliSenseEngineDefault: PersistentState<number>;
|
||||
private recursiveIncludesDefault: PersistentState<number>;
|
||||
private gotoDefIntelliSenseDefault: PersistentState<number>;
|
||||
private enhancedColorizationDefault: PersistentState<number>;
|
||||
private bucket: PersistentState<number>;
|
||||
|
||||
constructor() {
|
||||
this.intelliSenseEngineDefault = new PersistentState<number>("ABTest.1", 100);
|
||||
this.recursiveIncludesDefault = new PersistentState<number>("ABTest.2", 100);
|
||||
this.gotoDefIntelliSenseDefault = new PersistentState<number>("ABTest.3", 100);
|
||||
this.enhancedColorizationDefault = new PersistentState<number>("ABTest.4", 100);
|
||||
this.settings = {
|
||||
defaultIntelliSenseEngine: this.intelliSenseEngineDefault.Value,
|
||||
recursiveIncludes: this.recursiveIncludesDefault.Value
|
||||
recursiveIncludes: this.recursiveIncludesDefault.Value,
|
||||
gotoDefIntelliSense: this.gotoDefIntelliSenseDefault.Value,
|
||||
enhancedColorization: this.enhancedColorizationDefault.Value
|
||||
};
|
||||
this.bucket = new PersistentState<number>(userBucketString, -1);
|
||||
if (this.bucket.Value === -1) {
|
||||
this.bucket.Value = Math.floor(Math.random() * userBucketMax) + 1; // Range is [1, userBucketMax].
|
||||
}
|
||||
|
||||
this.updateSettingsAsync().then(() => {
|
||||
// Redownload cpptools.json after initialization so it's not blocked.
|
||||
// It'll be used the next time the extension reloads.
|
||||
this.downloadCpptoolsJsonPkgAsync();
|
||||
});
|
||||
this.updateSettings();
|
||||
// Redownload cpptools.json after initialization so it's not blocked.
|
||||
// It'll be used the next time the extension reloads.
|
||||
this.downloadCpptoolsJsonPkgAsync();
|
||||
|
||||
// Redownload occasionally to prevent an extra reload during long sessions.
|
||||
setInterval(() => { this.downloadCpptoolsJsonPkgAsync(); }, 30 * 60 * 1000); // 30 minutes.
|
||||
}
|
||||
|
||||
public get UseDefaultIntelliSenseEngine(): boolean {
|
||||
return this.settings.defaultIntelliSenseEngine ? this.settings.defaultIntelliSenseEngine >= this.bucket.Value : true;
|
||||
return util.isNumber(this.settings.defaultIntelliSenseEngine) ? this.settings.defaultIntelliSenseEngine >= this.bucket.Value : true;
|
||||
}
|
||||
|
||||
public get UseRecursiveIncludes(): boolean {
|
||||
return this.settings.recursiveIncludes ? this.settings.recursiveIncludes >= this.bucket.Value : true;
|
||||
return util.isNumber(this.settings.recursiveIncludes) ? this.settings.recursiveIncludes >= this.bucket.Value : true;
|
||||
}
|
||||
|
||||
private async updateSettingsAsync(): Promise<void> {
|
||||
public get UseGoToDefIntelliSense(): boolean {
|
||||
return util.isNumber(this.settings.gotoDefIntelliSense) ? this.settings.gotoDefIntelliSense >= this.bucket.Value : true;
|
||||
}
|
||||
|
||||
public get UseEnhancedColorization(): boolean {
|
||||
return util.isNumber(this.settings.enhancedColorization) ? this.settings.enhancedColorization >= this.bucket.Value : true;
|
||||
}
|
||||
|
||||
private updateSettings(): void {
|
||||
const cpptoolsJsonFile: string = util.getExtensionFilePath(localConfigFile);
|
||||
|
||||
|
||||
try {
|
||||
const exists: boolean = await util.checkFileExists(cpptoolsJsonFile);
|
||||
const exists: boolean = fs.existsSync(cpptoolsJsonFile);
|
||||
if (exists) {
|
||||
const fileContent: string = await util.readFileText(cpptoolsJsonFile);
|
||||
const fileContent: string = fs.readFileSync(cpptoolsJsonFile).toString();
|
||||
let newSettings: Settings = <Settings>JSON.parse(fileContent);
|
||||
if (newSettings.defaultIntelliSenseEngine) {
|
||||
this.intelliSenseEngineDefault.Value = newSettings.defaultIntelliSenseEngine;
|
||||
}
|
||||
if (newSettings.recursiveIncludes) {
|
||||
this.recursiveIncludesDefault.Value = newSettings.recursiveIncludes;
|
||||
}
|
||||
this.intelliSenseEngineDefault.Value = util.isNumber(newSettings.defaultIntelliSenseEngine) ? newSettings.defaultIntelliSenseEngine : this.intelliSenseEngineDefault.DefaultValue;
|
||||
this.recursiveIncludesDefault.Value = util.isNumber(newSettings.recursiveIncludes) ? newSettings.recursiveIncludes : this.recursiveIncludesDefault.DefaultValue;
|
||||
this.gotoDefIntelliSenseDefault.Value = util.isNumber(newSettings.gotoDefIntelliSense) ? newSettings.gotoDefIntelliSense : this.gotoDefIntelliSenseDefault.DefaultValue;
|
||||
this.enhancedColorizationDefault.Value = util.isNumber(newSettings.enhancedColorization) ? newSettings.enhancedColorization : this.enhancedColorizationDefault.DefaultValue;
|
||||
this.settings = {
|
||||
defaultIntelliSenseEngine: this.intelliSenseEngineDefault.Value,
|
||||
recursiveIncludes: this.recursiveIncludesDefault.Value
|
||||
recursiveIncludes: this.recursiveIncludesDefault.Value,
|
||||
gotoDefIntelliSense: this.gotoDefIntelliSenseDefault.Value,
|
||||
enhancedColorization: this.enhancedColorizationDefault.Value
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -83,50 +93,17 @@ export class ABTestSettings {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: Code is copied from DownloadPackage in packageManager.ts, but with ~75% fewer lines.
|
||||
private downloadCpptoolsJsonAsync(urlString): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let parsedUrl: url.Url = url.parse(urlString);
|
||||
let request: ClientRequest = https.request({
|
||||
host: parsedUrl.host,
|
||||
path: parsedUrl.path,
|
||||
agent: util.getHttpsProxyAgent(),
|
||||
rejectUnauthorized: vscode.workspace.getConfiguration().get("http.proxyStrictSSL", true)
|
||||
}, (response) => {
|
||||
if (response.statusCode === 301 || response.statusCode === 302) {
|
||||
let redirectUrl: string | string[];
|
||||
if (typeof response.headers.location === "string") {
|
||||
redirectUrl = response.headers.location;
|
||||
} else {
|
||||
redirectUrl = response.headers.location[0];
|
||||
}
|
||||
return resolve(this.downloadCpptoolsJsonAsync(redirectUrl)); // Redirect - download from new location
|
||||
}
|
||||
if (response.statusCode !== 200) {
|
||||
return reject();
|
||||
}
|
||||
let downloadedBytes = 0; // tslint:disable-line
|
||||
let cppToolsJsonFile: fs.WriteStream = fs.createWriteStream(util.getExtensionFilePath(localConfigFile));
|
||||
response.on('data', (data) => { downloadedBytes += data.length; });
|
||||
response.on('end', () => { cppToolsJsonFile.close(); });
|
||||
cppToolsJsonFile.on('close', () => { resolve(); this.updateSettingsAsync(); });
|
||||
response.on('error', (error) => { reject(); });
|
||||
response.pipe(cppToolsJsonFile, { end: false });
|
||||
});
|
||||
request.on('error', (error) => { reject(); });
|
||||
request.end();
|
||||
});
|
||||
}
|
||||
|
||||
private downloadCpptoolsJsonPkgAsync(): Promise<void> {
|
||||
let hasError: boolean = false;
|
||||
let telemetryProperties: { [key: string]: string } = {};
|
||||
return this.downloadCpptoolsJsonAsync("https://go.microsoft.com/fwlink/?linkid=852750")
|
||||
const localConfigPath: string = util.getExtensionFilePath(localConfigFile);
|
||||
return util.downloadFileToDestination("https://go.microsoft.com/fwlink/?linkid=2097702", localConfigPath)
|
||||
.catch((error) => {
|
||||
// More specific error info is not likely to be helpful, and we get detailed download data from the initial install.
|
||||
hasError = true;
|
||||
})
|
||||
.then(() => {
|
||||
this.updateSettings();
|
||||
telemetryProperties['success'] = (!hasError).toString();
|
||||
Telemetry.logDebuggerEvent("cpptoolsJsonDownload", telemetryProperties);
|
||||
});
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||
* See 'LICENSE' in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import { CancellationToken } from 'vscode-jsonrpc';
|
||||
|
||||
/**
|
||||
* An interface to allow Custom Configuration Provider extensions to communicate with this extension.
|
||||
*/
|
||||
export interface CppToolsApi {
|
||||
/**
|
||||
* Register the Custom Configuration Provider.
|
||||
* This must be called as soon as the provider extension is ready. This is necessary for cpptools
|
||||
* to request configurations from the provider.
|
||||
* @param provider An instance of the [CustomConfigurationProvider](#CustomConfigurationProvider)
|
||||
* instance representing the provider extension.
|
||||
*/
|
||||
registerCustomConfigurationProvider(provider: CustomConfigurationProvider): void;
|
||||
|
||||
/**
|
||||
* Notifies cpptools that the current configuration has changed. Upon receiving this notification,
|
||||
* cpptools will request the new configurations.
|
||||
* @param provider An instance of the [CustomConfigurationProvider](#CustomConfigurationProvider)
|
||||
* instance representing the provider extension.
|
||||
*/
|
||||
didChangeCustomConfiguration(provider: CustomConfigurationProvider): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* An interface to allow this extension to communicate with Custom Configuration Provider extensions.
|
||||
*/
|
||||
export interface CustomConfigurationProvider {
|
||||
/**
|
||||
* The name of the Custom Configuration Provider extension.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* A request to determine whether this provider can provide IntelliSense configurations for the given document.
|
||||
* @param uri The URI of the document.
|
||||
* @param token (optional) The cancellation token.
|
||||
* @returns 'true' if this provider can provide IntelliSense configurations for the given document.
|
||||
*/
|
||||
canProvideConfiguration(uri: vscode.Uri, token?: CancellationToken): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* A request to get Intellisense configurations for the given files.
|
||||
* @param uris A list of one of more URIs for the files to provide configurations for.
|
||||
* @param token (optional) The cancellation token.
|
||||
* @returns A list of [SourceFileConfigurationItem](#SourceFileConfigurationItem) for the documents that this provider
|
||||
* is able to provide IntelliSense configurations for.
|
||||
* Note: If this provider cannot provide configurations for a file in `uris`, then the file will not be included
|
||||
* in the return value. An empty list will be returned if the provider cannot provide configurations for any of the files.
|
||||
*/
|
||||
provideConfigurations(uris: vscode.Uri[], token?: CancellationToken): Thenable<SourceFileConfigurationItem[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* The model representing the custom IntelliSense configurations for a source file.
|
||||
*/
|
||||
export interface SourceFileConfiguration {
|
||||
/**
|
||||
* This must also include the system include path (compiler defaults) unless
|
||||
* [compilerPath](#SourceFileConfiguration.compilerPath) is specified.
|
||||
*/
|
||||
includePath: string[];
|
||||
|
||||
/**
|
||||
* This must also include the compiler default defines (__cplusplus, etc) unless
|
||||
* [compilerPath](#SourceFileConfiguration.compilerPath) is specified.
|
||||
*/
|
||||
defines: string[];
|
||||
|
||||
/**
|
||||
* Currently, "msvc-x64" or "clang-x64".
|
||||
*/
|
||||
intelliSenseMode: string;
|
||||
|
||||
/**
|
||||
* The C or C++ standard. See `package.json` for valid values.
|
||||
*/
|
||||
standard: string;
|
||||
|
||||
/**
|
||||
* Any files that need to be included before the source file is parsed.
|
||||
*/
|
||||
forcedInclude?: string[];
|
||||
|
||||
/**
|
||||
* The full path to the compiler. If specified, the extension will query it for default includes and defines and
|
||||
* add them to [includePath](#SourceFileConfiguration.includePath) and [defines](#SourceFileConfiguration.defines).
|
||||
*/
|
||||
compilerPath?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A model representing a source file and its corresponding configuration.
|
||||
*/
|
||||
export interface SourceFileConfigurationItem {
|
||||
/**
|
||||
* The URI of the source file.
|
||||
*/
|
||||
uri: string;
|
||||
|
||||
/**
|
||||
* The IntelliSense configuration for [uri](#SourceFileConfigurationItem.uri)
|
||||
*/
|
||||
configuration: SourceFileConfiguration;
|
||||
}
|
||||
+37
-16
@@ -6,29 +6,32 @@
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as LanguageServer from './LanguageServer/extension';
|
||||
import * as util from './common';
|
||||
|
||||
class TemporaryCommandRegistrar {
|
||||
// Used to save/re-execute commands used before the extension has activated (e.g. delayed by dependency downloading).
|
||||
private delayedCommandsToExecute: Set<string>;
|
||||
private tempCommands: vscode.Disposable[]; // Need to save this to unregister/dispose the temporary commands.
|
||||
private isLanguageServerDisabled: boolean = false;
|
||||
private isActivationReady: boolean = false;
|
||||
|
||||
private commandsToRegister: string[] = [
|
||||
"C_Cpp.ConfigurationEdit",
|
||||
"C_Cpp.ConfigurationEditJSON",
|
||||
"C_Cpp.ConfigurationEditUI",
|
||||
"C_Cpp.ConfigurationSelect",
|
||||
"C_Cpp.ConfigurationProviderSelect",
|
||||
"C_Cpp.SwitchHeaderSource",
|
||||
"C_Cpp.Navigate",
|
||||
"C_Cpp.GoToDeclaration",
|
||||
"C_Cpp.PeekDeclaration",
|
||||
"C_Cpp.ToggleErrorSquiggles",
|
||||
"C_Cpp.EnableErrorSquiggles",
|
||||
"C_Cpp.DisableErrorSquiggles",
|
||||
"C_Cpp.ToggleIncludeFallback",
|
||||
"C_Cpp.ToggleDimInactiveRegions",
|
||||
"C_Cpp.ToggleSnippets",
|
||||
"C_Cpp.ShowReleaseNotes",
|
||||
"C_Cpp.ResetDatabase",
|
||||
"C_Cpp.PauseParsing",
|
||||
"C_Cpp.ResumeParsing",
|
||||
"C_Cpp.ShowParsingCommands",
|
||||
"C_Cpp.TakeSurvey"
|
||||
"C_Cpp.TakeSurvey",
|
||||
"C_Cpp.LogDiagnostics",
|
||||
"C_Cpp.RescanWorkspace",
|
||||
"C_Cpp.VcpkgClipboardInstallSuggested",
|
||||
"C_Cpp.VcpkgOnlineHelpSuggested"
|
||||
];
|
||||
|
||||
constructor() {
|
||||
@@ -36,26 +39,44 @@ class TemporaryCommandRegistrar {
|
||||
this.delayedCommandsToExecute = new Set<string>();
|
||||
|
||||
// Add temp commands that invoke the real commands after download/install is complete (preventing an error message)
|
||||
this.commandsToRegister.forEach(command => {
|
||||
this.registerTempCommand(command);
|
||||
});
|
||||
if (util.extensionContext) {
|
||||
this.commandsToRegister.forEach(command => {
|
||||
this.registerTempCommand(command);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public registerTempCommand(command: string): void {
|
||||
this.tempCommands.push(vscode.commands.registerCommand(command, () => {
|
||||
if (this.isLanguageServerDisabled) {
|
||||
vscode.window.showInformationMessage("This command is disabled because \"C_Cpp.intelliSenseEngine\" is set to \"Disabled\".");
|
||||
return;
|
||||
}
|
||||
this.delayedCommandsToExecute.add(command);
|
||||
if (this.isActivationReady) {
|
||||
LanguageServer.activate(true);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
public disableLanguageServer(): void {
|
||||
this.isLanguageServerDisabled = true;
|
||||
}
|
||||
|
||||
public activateLanguageServer(): void {
|
||||
// Main activation code.
|
||||
LanguageServer.activate(this.delayedCommandsToExecute.size > 0);
|
||||
this.isActivationReady = true;
|
||||
}
|
||||
|
||||
public clearTempCommands(): void {
|
||||
this.tempCommands.forEach((command) => {
|
||||
command.dispose();
|
||||
});
|
||||
this.tempCommands = [];
|
||||
}
|
||||
|
||||
LanguageServer.activate(this.delayedCommandsToExecute.size > 0);
|
||||
|
||||
public executeDelayedCommands(): void {
|
||||
this.delayedCommandsToExecute.forEach((command) => {
|
||||
vscode.commands.executeCommand(command);
|
||||
});
|
||||
@@ -71,4 +92,4 @@ export function initializeTemporaryCommandRegistrar(): void {
|
||||
|
||||
export function getTemporaryCommandRegistrarInstance(): TemporaryCommandRegistrar {
|
||||
return tempCommandRegistrar;
|
||||
}
|
||||
}
|
||||
|
||||
+454
-57
@@ -14,11 +14,26 @@ import * as url from 'url';
|
||||
import { PlatformInformation } from './platform';
|
||||
import { getOutputChannelLogger, showOutputChannel } from './logger';
|
||||
import * as assert from 'assert';
|
||||
import * as https from 'https';
|
||||
import { ClientRequest, OutgoingHttpHeaders } from 'http';
|
||||
import { getBuildTasks } from './LanguageServer/extension';
|
||||
import { OtherSettings } from './LanguageServer/settings';
|
||||
|
||||
export type Mutable<T> = {
|
||||
-readonly [P in keyof T]: T[P] extends ReadonlyArray<infer U> ? Mutable<U>[] : Mutable<T[P]>
|
||||
};
|
||||
|
||||
export let extensionPath: string;
|
||||
export let extensionContext: vscode.ExtensionContext;
|
||||
export function setExtensionContext(context: vscode.ExtensionContext): void {
|
||||
extensionContext = context;
|
||||
extensionPath = extensionContext.extensionPath;
|
||||
}
|
||||
export function setExtensionPath(path: string): void {
|
||||
extensionPath = path;
|
||||
}
|
||||
|
||||
export const failedToParseTasksJson: string = "Failed to parse tasks.json, possibly due to comments or trailing commas.";
|
||||
|
||||
// Use this package.json to read values
|
||||
export const packageJson: any = vscode.extensions.getExtension("ms-vscode.cpptools").packageJSON;
|
||||
@@ -34,6 +49,69 @@ export function getRawPackageJson(): any {
|
||||
return rawPackageJson;
|
||||
}
|
||||
|
||||
export function getRawTasksJson(): Promise<any> {
|
||||
const path: string = getTasksJsonPath();
|
||||
if (!path) {
|
||||
return undefined;
|
||||
}
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
fs.exists(path, exists => {
|
||||
if (!exists) {
|
||||
return resolve({});
|
||||
}
|
||||
let fileContents: string = fs.readFileSync(path).toString();
|
||||
fileContents = fileContents.replace(/^\s*\/\/.*$/gm, ""); // Remove start of line // comments.
|
||||
let rawTasks: any = {};
|
||||
try {
|
||||
rawTasks = JSON.parse(fileContents);
|
||||
} catch (error) {
|
||||
return reject(new Error(failedToParseTasksJson));
|
||||
}
|
||||
resolve(rawTasks);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export async function ensureBuildTaskExists(taskName: string): Promise<void> {
|
||||
let rawTasksJson: any = await getRawTasksJson();
|
||||
|
||||
// Ensure that the task exists in the user's task.json. Task will not be found otherwise.
|
||||
if (!rawTasksJson.tasks) {
|
||||
rawTasksJson.tasks = new Array();
|
||||
}
|
||||
// Find or create the task which should be created based on the selected "debug configuration".
|
||||
let selectedTask: vscode.Task = rawTasksJson.tasks.find(task => {
|
||||
return task.label && task.label === task;
|
||||
});
|
||||
if (selectedTask) {
|
||||
return;
|
||||
}
|
||||
|
||||
const buildTasks: vscode.Task[] = await getBuildTasks(false);
|
||||
selectedTask = buildTasks.find(task => task.name === taskName);
|
||||
console.assert(selectedTask);
|
||||
|
||||
rawTasksJson.version = "2.0.0";
|
||||
|
||||
if (!rawTasksJson.tasks.find(task => task.label === selectedTask.definition.label)) {
|
||||
rawTasksJson.tasks.push(selectedTask.definition);
|
||||
}
|
||||
|
||||
// TODO: It's dangerous to overwrite this file. We could be wiping out comments.
|
||||
let settings: OtherSettings = new OtherSettings();
|
||||
await writeFileText(getTasksJsonPath(), JSON.stringify(rawTasksJson, null, settings.editorTabSize));
|
||||
}
|
||||
|
||||
export function fileIsCOrCppSource(file: string): boolean {
|
||||
const fileExtLower: string = path.extname(file).toLowerCase();
|
||||
return [".C", ".c", ".cpp", ".cc", ".cxx", ".mm", ".ino", ".inl"].some(ext => fileExtLower === ext);
|
||||
}
|
||||
|
||||
export function isEditorFileCpp(file: string): boolean {
|
||||
let editor: vscode.TextEditor = vscode.window.visibleTextEditors.find(e => e.document.uri.toString() === file);
|
||||
return editor && editor.document.languageId === "cpp";
|
||||
}
|
||||
|
||||
// This function is used to stringify the rawPackageJson.
|
||||
// Do not use with util.packageJson or else the expanded
|
||||
// package.json will be written back.
|
||||
@@ -42,13 +120,22 @@ export function stringifyPackageJson(packageJson: string): string {
|
||||
}
|
||||
|
||||
export function getExtensionFilePath(extensionfile: string): string {
|
||||
return path.resolve(extensionContext.extensionPath, extensionfile);
|
||||
return path.resolve(extensionPath, extensionfile);
|
||||
}
|
||||
|
||||
export function getPackageJsonPath(): string {
|
||||
return getExtensionFilePath("package.json");
|
||||
}
|
||||
|
||||
export function getTasksJsonPath(): string {
|
||||
const editor: vscode.TextEditor = vscode.window.activeTextEditor;
|
||||
const folder: vscode.WorkspaceFolder = vscode.workspace.getWorkspaceFolder(editor.document.uri);
|
||||
if (!folder) {
|
||||
return undefined;
|
||||
}
|
||||
return path.join(folder.uri.fsPath, ".vscode", "tasks.json");
|
||||
}
|
||||
|
||||
export function getVcpkgPathDescriptorFile(): string {
|
||||
if (process.platform === 'win32') {
|
||||
return path.join(process.env.LOCALAPPDATA, "vcpkg/vcpkg.path.txt");
|
||||
@@ -57,6 +144,32 @@ export function getVcpkgPathDescriptorFile(): string {
|
||||
}
|
||||
}
|
||||
|
||||
let vcpkgRoot: string;
|
||||
export function getVcpkgRoot(): string {
|
||||
if (!vcpkgRoot && vcpkgRoot !== "") {
|
||||
vcpkgRoot = "";
|
||||
// Check for vcpkg instance.
|
||||
if (fs.existsSync(getVcpkgPathDescriptorFile())) {
|
||||
let vcpkgRootTemp: string = fs.readFileSync(getVcpkgPathDescriptorFile()).toString();
|
||||
vcpkgRootTemp = vcpkgRootTemp.trim();
|
||||
if (fs.existsSync(vcpkgRootTemp)) {
|
||||
vcpkgRoot = path.join(vcpkgRootTemp, "/installed").replace(/\\/g, "/");
|
||||
}
|
||||
}
|
||||
}
|
||||
return vcpkgRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a fuzzy determination of whether a uri represents a header file.
|
||||
* For the purposes of this function, a header file has no extension, or an extension that begins with the letter 'h'.
|
||||
* @param document The document to check.
|
||||
*/
|
||||
export function isHeader(uri: vscode.Uri): boolean {
|
||||
let ext: string = path.extname(uri.fsPath);
|
||||
return !ext || ext.startsWith(".h") || ext.startsWith(".H");
|
||||
}
|
||||
|
||||
// Extension is ready if install.lock exists and debugAdapters folder exist.
|
||||
export async function isExtensionReady(): Promise<boolean> {
|
||||
const doesInstallLockFileExist: boolean = await checkInstallLockFile();
|
||||
@@ -96,15 +209,15 @@ let installProgressStr: string = "CPP." + packageJson.version + ".Progress";
|
||||
let intelliSenseProgressStr: string = "CPP." + packageJson.version + ".IntelliSenseProgress";
|
||||
|
||||
export function getProgress(): number {
|
||||
return extensionContext.globalState.get<number>(installProgressStr, -1);
|
||||
return extensionContext ? extensionContext.globalState.get<number>(installProgressStr, -1) : -1;
|
||||
}
|
||||
|
||||
export function getIntelliSenseProgress(): number {
|
||||
return extensionContext.globalState.get<number>(intelliSenseProgressStr, -1);
|
||||
return extensionContext ? extensionContext.globalState.get<number>(intelliSenseProgressStr, -1) : -1;
|
||||
}
|
||||
|
||||
export function setProgress(progress: number): void {
|
||||
if (getProgress() < progress) {
|
||||
if (extensionContext && getProgress() < progress) {
|
||||
extensionContext.globalState.update(installProgressStr, progress);
|
||||
let telemetryProperties: { [key: string]: string } = {};
|
||||
let progressName: string;
|
||||
@@ -121,7 +234,7 @@ export function setProgress(progress: number): void {
|
||||
}
|
||||
|
||||
export function setIntelliSenseProgress(progress: number): void {
|
||||
if (getIntelliSenseProgress() < progress) {
|
||||
if (extensionContext && getIntelliSenseProgress() < progress) {
|
||||
extensionContext.globalState.update(intelliSenseProgressStr, progress);
|
||||
let telemetryProperties: { [key: string]: string } = {};
|
||||
let progressName: string;
|
||||
@@ -139,8 +252,49 @@ export function getProgressExecutableSuccess(): number { return progressExecutab
|
||||
export function getProgressParseRootSuccess(): number { return progressParseRootSuccess; } // Parse root was successful (i.e. not blocked by processing taking too long).
|
||||
export function getProgressIntelliSenseNoSquiggles(): number { return progressIntelliSenseNoSquiggles; } // IntelliSense was successful and the user got no squiggles.
|
||||
|
||||
export function showReleaseNotes(): void {
|
||||
vscode.commands.executeCommand('vscode.previewHtml', vscode.Uri.file(getExtensionFilePath("ReleaseNotes.html")), vscode.ViewColumn.One, "C/C++ Extension Release Notes");
|
||||
export function isUri(input: any): input is vscode.Uri {
|
||||
return input && input instanceof vscode.Uri;
|
||||
}
|
||||
|
||||
export function isString(input: any): input is string {
|
||||
return typeof(input) === "string";
|
||||
}
|
||||
|
||||
export function isNumber(input: any): input is number {
|
||||
return typeof(input) === "number";
|
||||
}
|
||||
|
||||
export function isBoolean(input: any): input is boolean {
|
||||
return typeof(input) === "boolean";
|
||||
}
|
||||
|
||||
export function isArray(input: any): input is any[] {
|
||||
return input instanceof Array;
|
||||
}
|
||||
|
||||
export function isOptionalString(input: any): input is string|undefined {
|
||||
return input === undefined || isString(input);
|
||||
}
|
||||
|
||||
export function isArrayOfString(input: any): input is string[] {
|
||||
return isArray(input) && input.every(isString);
|
||||
}
|
||||
|
||||
export function isOptionalArrayOfString(input: any): input is string[]|undefined {
|
||||
return input === undefined || isArrayOfString(input);
|
||||
}
|
||||
|
||||
export function resolveCachePath(input: string, additionalEnvironment: {[key: string]: string | string[]}): string {
|
||||
let resolvedPath: string = "";
|
||||
if (!input) {
|
||||
// If no path is set, return empty string to language service process, where it will set the default path as
|
||||
// Windows: %LocalAppData%/Microsoft/vscode-cpptools/
|
||||
// Linux and Mac: ~/.vscode-cpptools/
|
||||
return resolvedPath;
|
||||
}
|
||||
|
||||
resolvedPath = resolveVariables(input, additionalEnvironment);
|
||||
return resolvedPath;
|
||||
}
|
||||
|
||||
export function resolveVariables(input: string, additionalEnvironment: {[key: string]: string | string[]}): string {
|
||||
@@ -152,55 +306,60 @@ export function resolveVariables(input: string, additionalEnvironment: {[key: st
|
||||
}
|
||||
|
||||
// Replace environment and configuration variables.
|
||||
let regexp: RegExp = /\$\{((env|config|workspaceFolder)(.|:))?(.*?)\}/g;
|
||||
let ret: string = input.replace(regexp, (match: string, ignored1: string, varType: string, ignored2: string, name: string) => {
|
||||
// Historically, if the variable didn't have anything before the "." or ":"
|
||||
// it was assumed to be an environment variable
|
||||
if (varType === undefined) {
|
||||
varType = "env";
|
||||
}
|
||||
let newValue: string = undefined;
|
||||
switch (varType) {
|
||||
case "env": {
|
||||
let v: string | string[] = additionalEnvironment[name];
|
||||
if (typeof v === "string") {
|
||||
newValue = v;
|
||||
} else if (input === match && v instanceof Array) {
|
||||
newValue = v.join(";");
|
||||
}
|
||||
if (!newValue) {
|
||||
newValue = process.env[name];
|
||||
}
|
||||
break;
|
||||
let regexp: () => RegExp = () => /\$\{((env|config|workspaceFolder)(\.|:))?(.*?)\}/g;
|
||||
let ret: string = input;
|
||||
let cycleCache: Set<string> = new Set();
|
||||
while (!cycleCache.has(ret)) {
|
||||
cycleCache.add(ret);
|
||||
ret = ret.replace(regexp(), (match: string, ignored1: string, varType: string, ignored2: string, name: string) => {
|
||||
// Historically, if the variable didn't have anything before the "." or ":"
|
||||
// it was assumed to be an environment variable
|
||||
if (varType === undefined) {
|
||||
varType = "env";
|
||||
}
|
||||
case "config": {
|
||||
let config: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration();
|
||||
if (config) {
|
||||
newValue = config.get<string>(name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "workspaceFolder": {
|
||||
// Only replace ${workspaceFolder:name} variables for now.
|
||||
// We may consider doing replacement of ${workspaceFolder} here later, but we would have to update the language server and also
|
||||
// intercept messages with paths in them and add the ${workspaceFolder} variable back in (e.g. for light bulb suggestions)
|
||||
if (name && vscode.workspace && vscode.workspace.workspaceFolders) {
|
||||
let folder: vscode.WorkspaceFolder = vscode.workspace.workspaceFolders.find(folder => folder.name.toLocaleLowerCase() === name.toLocaleLowerCase());
|
||||
if (folder) {
|
||||
newValue = folder.uri.fsPath;
|
||||
let newValue: string;
|
||||
switch (varType) {
|
||||
case "env": {
|
||||
let v: string | string[] = additionalEnvironment[name];
|
||||
if (isString(v)) {
|
||||
newValue = v;
|
||||
} else if (input === match && isArrayOfString(v)) {
|
||||
newValue = v.join(";");
|
||||
}
|
||||
if (!isString(newValue)) {
|
||||
newValue = process.env[name];
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "config": {
|
||||
let config: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration();
|
||||
if (config) {
|
||||
newValue = config.get<string>(name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "workspaceFolder": {
|
||||
// Only replace ${workspaceFolder:name} variables for now.
|
||||
// We may consider doing replacement of ${workspaceFolder} here later, but we would have to update the language server and also
|
||||
// intercept messages with paths in them and add the ${workspaceFolder} variable back in (e.g. for light bulb suggestions)
|
||||
if (name && vscode.workspace && vscode.workspace.workspaceFolders) {
|
||||
let folder: vscode.WorkspaceFolder = vscode.workspace.workspaceFolders.find(folder => folder.name.toLocaleLowerCase() === name.toLocaleLowerCase());
|
||||
if (folder) {
|
||||
newValue = folder.uri.fsPath;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: { assert.fail("unknown varType matched"); }
|
||||
}
|
||||
default: { assert.fail("unknown varType matched"); }
|
||||
}
|
||||
return (newValue) ? newValue : match;
|
||||
});
|
||||
return (isString(newValue)) ? newValue : match;
|
||||
});
|
||||
}
|
||||
|
||||
// Resolve '~' at the start of the path.
|
||||
regexp = /^\~/g;
|
||||
ret = ret.replace(regexp, (match: string, name: string) => {
|
||||
let newValue: string = process.env.HOME;
|
||||
regexp = () => /^\~/g;
|
||||
ret = ret.replace(regexp(), (match: string, name: string) => {
|
||||
let newValue: string = (process.platform === 'win32') ? process.env.USERPROFILE : process.env.HOME;
|
||||
return (newValue) ? newValue : match;
|
||||
});
|
||||
|
||||
@@ -277,7 +436,7 @@ export function touchInstallLockFile(): Promise<void> {
|
||||
|
||||
export function touchExtensionFolder(): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
fs.utimes(path.resolve(extensionContext.extensionPath, ".."), new Date(Date.now()), new Date(Date.now()), (err) => {
|
||||
fs.utimes(path.resolve(extensionPath, ".."), new Date(Date.now()), new Date(Date.now()), (err) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
@@ -313,6 +472,23 @@ export function checkDirectoryExists(dirPath: string): Promise<boolean> {
|
||||
});
|
||||
}
|
||||
|
||||
export function checkFileExistsSync(filePath: string): boolean {
|
||||
try {
|
||||
return fs.statSync(filePath).isFile();
|
||||
} catch (e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Test whether a directory exists */
|
||||
export function checkDirectoryExistsSync(dirPath: string): boolean {
|
||||
try {
|
||||
return fs.statSync(dirPath).isDirectory();
|
||||
} catch (e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Read the files in a directory */
|
||||
export function readDir(dirPath: string): Promise<string[]> {
|
||||
return new Promise((resolve) => {
|
||||
@@ -333,10 +509,9 @@ export function readFileText(filePath: string, encoding: string = "utf8"): Promi
|
||||
fs.readFile(filePath, encoding, (err, data) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
} else {
|
||||
resolve(data);
|
||||
}
|
||||
|
||||
resolve(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -347,14 +522,29 @@ export function writeFileText(filePath: string, content: string, encoding: strin
|
||||
fs.writeFile(filePath, content, { encoding }, (err) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteFile(filePath: string): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
if (fs.existsSync(filePath)) {
|
||||
fs.unlink(filePath, (err) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Get the path of the lock file. This is used to indicate that the platform-specific dependencies have been downloaded.
|
||||
export function getInstallLockPath(): string {
|
||||
return getExtensionFilePath("install.lock");
|
||||
@@ -503,3 +693,210 @@ export async function renamePromise(oldName: string, newName: string): Promise<v
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export function promptForReloadWindowDueToSettingsChange(): void {
|
||||
promptReloadWindow("Reload the workspace for the settings change to take effect.");
|
||||
}
|
||||
|
||||
export function promptReloadWindow(message: string): void {
|
||||
let reload: string = "Reload";
|
||||
vscode.window.showInformationMessage(message, reload).then((value: string) => {
|
||||
if (value === reload) {
|
||||
vscode.commands.executeCommand("workbench.action.reloadWindow");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function downloadFileToDestination(urlStr: string, destinationPath: string, headers?: OutgoingHttpHeaders): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let parsedUrl: url.Url = url.parse(urlStr);
|
||||
let request: ClientRequest = https.request({
|
||||
host: parsedUrl.host,
|
||||
path: parsedUrl.path,
|
||||
agent: getHttpsProxyAgent(),
|
||||
rejectUnauthorized: vscode.workspace.getConfiguration().get('http.proxyStrictSSL', true),
|
||||
headers: headers
|
||||
}, (response) => {
|
||||
if (response.statusCode === 301 || response.statusCode === 302) { // If redirected
|
||||
// Download from new location
|
||||
let redirectUrl: string;
|
||||
if (typeof response.headers.location === 'string') {
|
||||
redirectUrl = response.headers.location;
|
||||
} else {
|
||||
redirectUrl = response.headers.location[0];
|
||||
}
|
||||
return resolve(downloadFileToDestination(redirectUrl, destinationPath, headers));
|
||||
}
|
||||
if (response.statusCode !== 200) { // If request is not successful
|
||||
return reject();
|
||||
}
|
||||
// Write file using downloaded data
|
||||
let createdFile: fs.WriteStream = fs.createWriteStream(destinationPath);
|
||||
createdFile.on('finish', () => { resolve(); });
|
||||
response.on('error', (error) => { reject(error); });
|
||||
response.pipe(createdFile);
|
||||
});
|
||||
request.on('error', (error) => { reject(error); });
|
||||
request.end();
|
||||
});
|
||||
}
|
||||
|
||||
export function downloadFileToStr(urlStr: string, headers?: OutgoingHttpHeaders): Promise<any> {
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
let parsedUrl: url.Url = url.parse(urlStr);
|
||||
let request: ClientRequest = https.request({
|
||||
host: parsedUrl.host,
|
||||
path: parsedUrl.path,
|
||||
agent: getHttpsProxyAgent(),
|
||||
rejectUnauthorized: vscode.workspace.getConfiguration().get('http.proxyStrictSSL', true),
|
||||
headers: headers
|
||||
}, (response) => {
|
||||
if (response.statusCode === 301 || response.statusCode === 302) { // If redirected
|
||||
// Download from new location
|
||||
let redirectUrl: string;
|
||||
if (typeof response.headers.location === 'string') {
|
||||
redirectUrl = response.headers.location;
|
||||
} else {
|
||||
redirectUrl = response.headers.location[0];
|
||||
}
|
||||
return resolve(downloadFileToStr(redirectUrl, headers));
|
||||
}
|
||||
if (response.statusCode !== 200) { // If request is not successful
|
||||
return reject();
|
||||
}
|
||||
let downloadedData: string = '';
|
||||
response.on('data', (data) => { downloadedData += data; });
|
||||
response.on('error', (error) => { reject(error); });
|
||||
response.on('end', () => { resolve(downloadedData); });
|
||||
});
|
||||
request.on('error', (error) => { reject(error); });
|
||||
request.end();
|
||||
});
|
||||
}
|
||||
|
||||
export interface CompilerPathAndArgs {
|
||||
compilerPath: string;
|
||||
compilerName: string;
|
||||
additionalArgs: string[];
|
||||
}
|
||||
|
||||
export function extractCompilerPathAndArgs(inputCompilerPath: string, inputCompilerArgs?: string[]): CompilerPathAndArgs {
|
||||
let compilerPath: string = inputCompilerPath;
|
||||
let compilerName: string = "";
|
||||
let additionalArgs: string[] = [];
|
||||
let isWindows: boolean = os.platform() === 'win32';
|
||||
if (compilerPath) {
|
||||
if (compilerPath === "cl.exe") {
|
||||
// Input is only compiler name, this is only for cl.exe
|
||||
compilerName = compilerPath;
|
||||
|
||||
} else if (compilerPath.startsWith("\"")) {
|
||||
// Input has quotes around compiler path
|
||||
let endQuote: number = compilerPath.substr(1).search("\"") + 1;
|
||||
if (endQuote !== -1) {
|
||||
additionalArgs = compilerPath.substr(endQuote + 1).split(" ");
|
||||
additionalArgs = additionalArgs.filter((arg: string) => arg.trim().length !== 0); // Remove empty args.
|
||||
compilerPath = compilerPath.substr(1, endQuote - 1);
|
||||
compilerName = path.basename(compilerPath);
|
||||
}
|
||||
} else {
|
||||
// Input has no quotes but can have a compiler path with spaces and args.
|
||||
// Go from right to left checking if a valid path is to the left of a space.
|
||||
let spaceStart: number = compilerPath.lastIndexOf(" ");
|
||||
if (spaceStart !== -1 && (!isWindows || !compilerPath.endsWith("cl.exe")) && !checkFileExistsSync(compilerPath)) {
|
||||
let potentialCompilerPath: string = compilerPath.substr(0, spaceStart);
|
||||
while ((!isWindows || !potentialCompilerPath.endsWith("cl.exe")) && !checkFileExistsSync(potentialCompilerPath)) {
|
||||
spaceStart = potentialCompilerPath.lastIndexOf(" ");
|
||||
if (spaceStart === -1) {
|
||||
// Reached the start without finding a valid path. Use the original value.
|
||||
potentialCompilerPath = compilerPath;
|
||||
break;
|
||||
}
|
||||
potentialCompilerPath = potentialCompilerPath.substr(0, spaceStart);
|
||||
}
|
||||
if (compilerPath !== potentialCompilerPath) {
|
||||
// Found a valid compilerPath and args.
|
||||
additionalArgs = compilerPath.substr(spaceStart + 1).split(" ");
|
||||
additionalArgs = additionalArgs.filter((arg: string) => arg.trim().length !== 0); // Remove empty args.
|
||||
compilerPath = potentialCompilerPath;
|
||||
}
|
||||
}
|
||||
// Get compiler name if there are no args but path is valid or a valid path was found with args.
|
||||
if (compilerPath === "cl.exe" || checkFileExistsSync(compilerPath)) {
|
||||
compilerName = path.basename(compilerPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Combine args from inputCompilerPath and inputCompilerArgs and remove duplicates
|
||||
if (inputCompilerArgs && inputCompilerArgs.length) {
|
||||
additionalArgs = inputCompilerArgs.concat(additionalArgs.filter(
|
||||
function (item: string): boolean {
|
||||
return inputCompilerArgs.indexOf(item) < 0;
|
||||
}));
|
||||
}
|
||||
return { compilerPath, compilerName, additionalArgs };
|
||||
}
|
||||
|
||||
export function escapeForSquiggles(s: string): string {
|
||||
// Replace all \<escape character> with \\<character>, except for \"
|
||||
// Otherwise, the JSON.parse result will have the \<escape character> missing.
|
||||
let newResults: string = "";
|
||||
let lastWasBackslash: Boolean = false;
|
||||
let lastBackslashWasEscaped: Boolean = false;
|
||||
for (let i: number = 0; i < s.length; i++) {
|
||||
if (s[i] === '\\') {
|
||||
if (lastWasBackslash) {
|
||||
newResults += "\\";
|
||||
lastBackslashWasEscaped = !lastBackslashWasEscaped;
|
||||
} else {
|
||||
lastBackslashWasEscaped = false;
|
||||
}
|
||||
newResults += "\\";
|
||||
lastWasBackslash = true;
|
||||
} else {
|
||||
if (lastWasBackslash && (lastBackslashWasEscaped || (s[i] !== '"'))) {
|
||||
newResults += "\\";
|
||||
}
|
||||
lastWasBackslash = false;
|
||||
lastBackslashWasEscaped = false;
|
||||
newResults += s[i];
|
||||
}
|
||||
}
|
||||
if (lastWasBackslash) {
|
||||
newResults += "\\";
|
||||
}
|
||||
return newResults;
|
||||
}
|
||||
|
||||
export class BlockingTask<T> {
|
||||
private dependency: BlockingTask<any>;
|
||||
private done: boolean = false;
|
||||
private promise: Thenable<T>;
|
||||
|
||||
constructor(task: () => Thenable<T>, dependency?: BlockingTask<any>) {
|
||||
if (!dependency) {
|
||||
this.promise = task();
|
||||
} else {
|
||||
this.dependency = dependency;
|
||||
this.promise = new Promise<T>((resolve, reject) => {
|
||||
let f1: () => void = () => {
|
||||
task().then(resolve, reject);
|
||||
};
|
||||
let f2: (err: any) => void = (err) => {
|
||||
console.log(err);
|
||||
task().then(resolve, reject);
|
||||
};
|
||||
this.dependency.promise.then(f1, f2);
|
||||
});
|
||||
}
|
||||
this.promise.then(() => this.done = true, () => this.done = true);
|
||||
}
|
||||
|
||||
public get Done(): boolean {
|
||||
return this.done;
|
||||
}
|
||||
|
||||
public getPromise(): Thenable<T> {
|
||||
return this.promise;
|
||||
}
|
||||
}
|
||||
|
||||
+124
-18
@@ -1,18 +1,124 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||
* See 'LICENSE' in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
|
||||
import { CppToolsApi, CustomConfigurationProvider } from './api';
|
||||
import * as LanguageServer from './LanguageServer/extension';
|
||||
|
||||
export class CppTools implements CppToolsApi {
|
||||
registerCustomConfigurationProvider(provider: CustomConfigurationProvider): void {
|
||||
LanguageServer.registerCustomConfigurationProvider(provider);
|
||||
}
|
||||
|
||||
didChangeCustomConfiguration(provider: CustomConfigurationProvider): void {
|
||||
LanguageServer.onDidChangeCustomConfiguration(provider);
|
||||
}
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||
* See 'LICENSE' in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
|
||||
import { CustomConfigurationProvider, Version } from 'vscode-cpptools';
|
||||
import { CppToolsTestApi, CppToolsTestHook } from 'vscode-cpptools/out/testApi';
|
||||
import { CustomConfigurationProvider1, getCustomConfigProviders, CustomConfigurationProviderCollection } from './LanguageServer/customProviders';
|
||||
import { getOutputChannel } from './logger';
|
||||
import * as LanguageServer from './LanguageServer/extension';
|
||||
import * as test from './testHook';
|
||||
|
||||
export class CppTools implements CppToolsTestApi {
|
||||
private version: Version;
|
||||
private providers: CustomConfigurationProvider1[] = [];
|
||||
private failedRegistrations: CustomConfigurationProvider[] = [];
|
||||
private timers = new Map<string, NodeJS.Timer>();
|
||||
|
||||
constructor(version: Version) {
|
||||
if (version > Version.latest) {
|
||||
console.warn(`version ${version} is not supported by this version of cpptools`);
|
||||
console.warn(` using ${Version.latest} instead`);
|
||||
version = Version.latest;
|
||||
}
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
private addNotifyReadyTimer(provider: CustomConfigurationProvider1): void {
|
||||
if (this.version >= Version.v2) {
|
||||
const timeout: number = 30;
|
||||
let timer: NodeJS.Timer = setTimeout(() => {
|
||||
console.warn(`registered provider ${provider.extensionId} did not call 'notifyReady' within ${timeout} seconds`);
|
||||
}, timeout * 1000);
|
||||
this.timers.set(provider.extensionId, timer);
|
||||
}
|
||||
}
|
||||
|
||||
private removeNotifyReadyTimer(provider: CustomConfigurationProvider1): void {
|
||||
if (this.version >= Version.v2) {
|
||||
let timer: NodeJS.Timer = this.timers.get(provider.extensionId);
|
||||
if (timer) {
|
||||
this.timers.delete(provider.extensionId);
|
||||
clearTimeout(timer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public getVersion(): Version {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public registerCustomConfigurationProvider(provider: CustomConfigurationProvider): void {
|
||||
let providers: CustomConfigurationProviderCollection = getCustomConfigProviders();
|
||||
if (providers.add(provider, this.version)) {
|
||||
let added: CustomConfigurationProvider1 = providers.get(provider);
|
||||
getOutputChannel().appendLine(`Custom configuration provider '${added.name}' registered`);
|
||||
this.providers.push(added);
|
||||
LanguageServer.getClients().forEach(client => client.onRegisterCustomConfigurationProvider(added));
|
||||
this.addNotifyReadyTimer(added);
|
||||
} else {
|
||||
this.failedRegistrations.push(provider);
|
||||
}
|
||||
}
|
||||
|
||||
public notifyReady(provider: CustomConfigurationProvider): void {
|
||||
let providers: CustomConfigurationProviderCollection = getCustomConfigProviders();
|
||||
let p: CustomConfigurationProvider1 = providers.get(provider);
|
||||
|
||||
if (p) {
|
||||
this.removeNotifyReadyTimer(p);
|
||||
p.isReady = true;
|
||||
LanguageServer.getClients().forEach(client => {
|
||||
client.updateCustomConfigurations(p);
|
||||
client.updateCustomBrowseConfiguration(p);
|
||||
});
|
||||
} else if (this.failedRegistrations.find(p => p === provider)) {
|
||||
console.warn("provider not successfully registered; 'notifyReady' ignored");
|
||||
} else {
|
||||
console.warn("provider should be registered before signaling it's ready to provide configurations");
|
||||
}
|
||||
}
|
||||
|
||||
public didChangeCustomConfiguration(provider: CustomConfigurationProvider): void {
|
||||
let providers: CustomConfigurationProviderCollection = getCustomConfigProviders();
|
||||
let p: CustomConfigurationProvider1 = providers.get(provider);
|
||||
|
||||
if (p) {
|
||||
if (!p.isReady) {
|
||||
console.warn("didChangeCustomConfiguration was invoked before notifyReady");
|
||||
}
|
||||
LanguageServer.getClients().forEach(client => client.updateCustomConfigurations(p));
|
||||
} else if (this.failedRegistrations.find(p => p === provider)) {
|
||||
console.warn("provider not successfully registered, 'didChangeCustomConfiguration' ignored");
|
||||
} else {
|
||||
console.warn("provider should be registered before sending config change messages");
|
||||
}
|
||||
}
|
||||
|
||||
public didChangeCustomBrowseConfiguration(provider: CustomConfigurationProvider): void {
|
||||
let providers: CustomConfigurationProviderCollection = getCustomConfigProviders();
|
||||
let p: CustomConfigurationProvider1 = providers.get(provider);
|
||||
|
||||
if (p) {
|
||||
LanguageServer.getClients().forEach(client => client.updateCustomBrowseConfiguration(p));
|
||||
} else if (this.failedRegistrations.find(p => p === provider)) {
|
||||
console.warn("provider not successfully registered, 'didChangeCustomBrowseConfiguration' ignored");
|
||||
} else {
|
||||
console.warn("provider should be registered before sending config change messages");
|
||||
}
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this.providers.forEach(provider => {
|
||||
getCustomConfigProviders().remove(provider);
|
||||
provider.dispose();
|
||||
});
|
||||
this.providers = [];
|
||||
}
|
||||
|
||||
public getTestHook(): CppToolsTestHook {
|
||||
return test.getTestHook();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||
* See 'LICENSE' in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
|
||||
import { CustomConfigurationProvider, Version, CppToolsApi, CppToolsExtension } from 'vscode-cpptools';
|
||||
import { CppToolsTestApi, CppToolsTestHook, CppToolsTestExtension } from 'vscode-cpptools/out/testApi';
|
||||
import { CppTools } from './cppTools';
|
||||
|
||||
/**
|
||||
* This class implements both interfaces since the extension returned CppToolsApi for v0,
|
||||
* but returns CppToolsTestExtension for v1 and later.
|
||||
*/
|
||||
export class CppTools1 implements CppToolsTestApi, CppToolsTestExtension {
|
||||
private backupApi: CppTools;
|
||||
|
||||
private get BackupApi(): CppToolsTestApi {
|
||||
if (!this.backupApi) {
|
||||
this.backupApi = new CppTools(Version.v0);
|
||||
}
|
||||
return this.backupApi;
|
||||
}
|
||||
|
||||
getApi(version: Version): CppToolsApi {
|
||||
switch (version) {
|
||||
case Version.v0:
|
||||
return this.BackupApi;
|
||||
|
||||
default:
|
||||
return new CppTools(version);
|
||||
}
|
||||
}
|
||||
|
||||
getTestApi(version: Version): CppToolsTestApi {
|
||||
return <CppToolsTestApi>this.getApi(version);
|
||||
}
|
||||
|
||||
getVersion(): Version {
|
||||
return this.BackupApi.getVersion();
|
||||
}
|
||||
|
||||
registerCustomConfigurationProvider(provider: CustomConfigurationProvider): void {
|
||||
this.BackupApi.registerCustomConfigurationProvider(provider);
|
||||
}
|
||||
|
||||
notifyReady(provider: CustomConfigurationProvider): void {
|
||||
this.BackupApi.notifyReady(provider);
|
||||
}
|
||||
|
||||
didChangeCustomConfiguration(provider: CustomConfigurationProvider): void {
|
||||
this.BackupApi.didChangeCustomConfiguration(provider);
|
||||
}
|
||||
|
||||
didChangeCustomBrowseConfiguration(provider: CustomConfigurationProvider): void {
|
||||
this.BackupApi.didChangeCustomBrowseConfiguration(provider);
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
}
|
||||
|
||||
getTestHook(): CppToolsTestHook {
|
||||
return this.BackupApi.getTestHook();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is an empty implementation of the API. Used when the extension is activated on
|
||||
* an unsupported platform.
|
||||
*/
|
||||
export class NullCppTools implements CppToolsApi, CppToolsExtension {
|
||||
private version: Version;
|
||||
|
||||
getApi(version: Version): CppToolsApi {
|
||||
this.version = version;
|
||||
return this;
|
||||
}
|
||||
|
||||
getVersion(): Version {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
registerCustomConfigurationProvider(provider: CustomConfigurationProvider): void {
|
||||
}
|
||||
|
||||
notifyReady(provider: CustomConfigurationProvider): void {
|
||||
}
|
||||
|
||||
didChangeCustomConfiguration(provider: CustomConfigurationProvider): void {
|
||||
}
|
||||
|
||||
didChangeCustomBrowseConfiguration(provider: CustomConfigurationProvider): void {
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,286 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||
* See 'LICENSE' in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
|
||||
import { PackageVersion } from './packageVersion';
|
||||
import * as util from './common';
|
||||
import { PlatformInformation } from './platform';
|
||||
import { OutgoingHttpHeaders } from 'http';
|
||||
|
||||
const testingInsidersVsixInstall: boolean = false; // Change this to true to enable testing of the Insiders vsix installation.
|
||||
|
||||
/**
|
||||
* The object representation of a Build Asset. Each Asset corresponds to information about a release file on GitHub.
|
||||
*/
|
||||
interface Asset {
|
||||
name: string;
|
||||
browser_download_url: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The object representation of a release in the GitHub API's release JSON.
|
||||
* Named Build so as to reduce confusion between a "Release" release and "Insiders" release.
|
||||
*/
|
||||
interface Build {
|
||||
name: string;
|
||||
assets: Asset[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Search each Asset by name to retrieve the download URL for a VSIX package
|
||||
* @param vsixName The name of the VSIX to search for
|
||||
* @return The download URL of the VSIX
|
||||
*/
|
||||
function getVsixDownloadUrl(build: Build, vsixName: string): string {
|
||||
const downloadUrl: string = build.assets.find(asset => {
|
||||
return asset.name === vsixName;
|
||||
}).browser_download_url;
|
||||
if (!downloadUrl) {
|
||||
throw new Error('Failed to find VSIX: ' + vsixName + ' in build: ' + build.name);
|
||||
}
|
||||
return downloadUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether an object is of type Asset.
|
||||
* @param input Incoming object.
|
||||
* @return Whether input is of type Asset.
|
||||
*/
|
||||
function isAsset(input: any): input is Asset {
|
||||
return input && input.name && typeof(input.name) === "string" &&
|
||||
input.browser_download_url && typeof(input.browser_download_url) === "string";
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether an object is of type Build. Note that earlier releases of the extension
|
||||
* do not have 4 or greater Assets (Mac, Win, Linux 32/64). Only call this on more recent Builds.
|
||||
* @param input Incoming object.
|
||||
* @return Whether input is of type Build.
|
||||
*/
|
||||
function isBuild(input: any): input is Build {
|
||||
return input && input.name && typeof(input.name) === "string" && isArrayOfAssets(input.assets) && input.assets.length >= 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether an object is of type Asset[].
|
||||
* @param input Incoming object.
|
||||
* @return Whether input is of type Asset[].
|
||||
*/
|
||||
function isArrayOfAssets(input: any): input is Asset[] {
|
||||
return input instanceof Array && input.every(isAsset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether an object is of type Build[].
|
||||
* @param input Incoming object.
|
||||
* @return Whether input is of type Build[].
|
||||
*/
|
||||
function isArrayOfBuilds(input: any): input is Build[] {
|
||||
if (!input || !(input instanceof Array) || input.length === 0) {
|
||||
return false;
|
||||
}
|
||||
// Only check the five most recent builds for validity -- no need to check all of them
|
||||
for (let i: number = 0; i < 5 && i < input.length; i++) {
|
||||
if (!isBuild(input[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Match the user's platform information to the VSIX name relevant to them.
|
||||
* @param info Information about the user's operating system.
|
||||
* @return VSIX filename for the extension's releases matched to the user's platform.
|
||||
*/
|
||||
function vsixNameForPlatform(info: PlatformInformation): string {
|
||||
const vsixName: string = function(platformInfo): string {
|
||||
switch (platformInfo.platform) {
|
||||
case 'win32': return 'cpptools-win32.vsix';
|
||||
case 'darwin': return 'cpptools-osx.vsix';
|
||||
default: {
|
||||
switch (platformInfo.architecture) {
|
||||
case 'x86_64': return 'cpptools-linux.vsix';
|
||||
case 'x86':
|
||||
case 'i386':
|
||||
case 'i686': return 'cpptools-linux32.vsix';
|
||||
}
|
||||
}
|
||||
}
|
||||
}(info);
|
||||
if (!vsixName) {
|
||||
throw new Error('Failed to match VSIX name for: ' + info.platform + ':' + info.architecture);
|
||||
}
|
||||
return vsixName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for return value of getTargetBuildInfo containing the download URL and version of a Build.
|
||||
*/
|
||||
export interface BuildInfo {
|
||||
downloadUrl: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the GitHub API to retrieve the download URL of the extension version the user should update to, if any.
|
||||
* @param updateChannel The user's updateChannel setting.
|
||||
* @return Download URL for the extension VSIX package that the user should install. If the user
|
||||
* does not need to update, resolves to undefined.
|
||||
*/
|
||||
export async function getTargetBuildInfo(updateChannel: string): Promise<BuildInfo> {
|
||||
return getReleaseJson()
|
||||
.then(builds => {
|
||||
if (!builds || builds.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// If the user version is greater than or incomparable to the latest available verion then there is no need to update
|
||||
// Allows testing pre-releases without accidentally downgrading to the latest version
|
||||
const userVersion: PackageVersion = new PackageVersion(util.packageJson.version);
|
||||
const latestVersion: PackageVersion = new PackageVersion(builds[0].name);
|
||||
if (!testingInsidersVsixInstall && (userVersion.isGreaterThan(latestVersion) || (userVersion.suffix && userVersion.suffix !== 'insiders'))) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return getTargetBuild(builds, userVersion, updateChannel);
|
||||
})
|
||||
.then(async build => {
|
||||
if (!build) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
try {
|
||||
const platformInfo: PlatformInformation = await PlatformInformation.GetPlatformInformation();
|
||||
const vsixName: string = vsixNameForPlatform(platformInfo);
|
||||
const downloadUrl: string = getVsixDownloadUrl(build, vsixName);
|
||||
return { downloadUrl: downloadUrl, name: build.name };
|
||||
} catch (error) {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether there exists a Build in the given Build[] that should be installed.
|
||||
* @param builds The GitHub release list parsed as an array of Builds.
|
||||
* @param userVersion The verion of the extension that the user is running.
|
||||
* @param updateChannel The user's updateChannel setting.
|
||||
* @return The Build if the user should update to it, otherwise undefined.
|
||||
*/
|
||||
function getTargetBuild(builds: Build[], userVersion: PackageVersion, updateChannel: string): Build {
|
||||
// Get predicates to determine the build to install, if any
|
||||
let needsUpdate: (installed: PackageVersion, target: PackageVersion) => boolean;
|
||||
let useBuild: (build: Build) => boolean;
|
||||
if (updateChannel === 'Insiders') {
|
||||
needsUpdate = (installed: PackageVersion, target: PackageVersion) => testingInsidersVsixInstall || target.isGreaterThan(installed);
|
||||
useBuild = (build: Build): boolean => true;
|
||||
} else if (updateChannel === 'Default') {
|
||||
needsUpdate = function(installed: PackageVersion, target: PackageVersion): boolean { return installed.isGreaterThan(target); };
|
||||
useBuild = (build: Build): boolean => build.name.indexOf('-') === -1;
|
||||
} else {
|
||||
throw new Error('Incorrect updateChannel setting provided');
|
||||
}
|
||||
|
||||
// Get the build to install
|
||||
const targetBuild: Build = builds.find(useBuild);
|
||||
if (!targetBuild) {
|
||||
throw new Error('Failed to determine installation candidate');
|
||||
}
|
||||
|
||||
// Check current version against target's version to determine if the installation should happen
|
||||
const targetVersion: PackageVersion = new PackageVersion(targetBuild.name);
|
||||
if (needsUpdate(userVersion, targetVersion)) {
|
||||
return targetBuild;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
interface Rate {
|
||||
remaining: number;
|
||||
}
|
||||
|
||||
interface RateLimit {
|
||||
rate: Rate;
|
||||
}
|
||||
|
||||
function isRate(input: any): input is Rate {
|
||||
return input && util.isNumber(input.remaining);
|
||||
}
|
||||
|
||||
function isRateLimit(input: any): input is RateLimit {
|
||||
return input && isRate(input.rate);
|
||||
}
|
||||
|
||||
async function getRateLimit(): Promise<RateLimit> {
|
||||
const header: OutgoingHttpHeaders = { 'User-Agent': 'vscode-cpptools' };
|
||||
const data: string = await util.downloadFileToStr('https://api.github.com/rate_limit', header)
|
||||
.catch((error) => {
|
||||
if (error && error.code && error.code !== "ENOENT") {
|
||||
// Only throw if the user is connected to the Internet.
|
||||
throw new Error('Failed to download rate limit JSON');
|
||||
}
|
||||
});
|
||||
if (!data) {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
let rateLimit: any;
|
||||
try {
|
||||
rateLimit = JSON.parse(data);
|
||||
} catch (error) {
|
||||
throw new Error('Failed to parse rate limit JSON');
|
||||
}
|
||||
|
||||
if (isRateLimit(rateLimit)) {
|
||||
return Promise.resolve(rateLimit);
|
||||
} else {
|
||||
throw new Error('Rate limit JSON is not of type RateLimit');
|
||||
}
|
||||
}
|
||||
|
||||
async function rateLimitExceeded(): Promise<boolean> {
|
||||
const rateLimit: RateLimit = await getRateLimit();
|
||||
return rateLimit && rateLimit.rate.remaining <= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download and parse the release list JSON from the GitHub API into a Build[].
|
||||
* @return Information about the released builds of the C/C++ extension.
|
||||
*/
|
||||
async function getReleaseJson(): Promise<Build[]> {
|
||||
if (await rateLimitExceeded()) {
|
||||
throw new Error('Failed to stay within GitHub API rate limit');
|
||||
}
|
||||
|
||||
// Download release JSON
|
||||
const releaseUrl: string = 'https://api.github.com/repos/Microsoft/vscode-cpptools/releases';
|
||||
const header: OutgoingHttpHeaders = { 'User-Agent': 'vscode-cpptools' };
|
||||
|
||||
const data: string = await util.downloadFileToStr(releaseUrl, header)
|
||||
.catch((error) => {
|
||||
if (error && error.code && error.code !== "ENOENT") {
|
||||
// Only throw if the user is connected to the Internet.
|
||||
throw new Error('Failed to download release JSON');
|
||||
}
|
||||
});
|
||||
if (!data) {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
// Parse the file
|
||||
let releaseJson: any;
|
||||
try {
|
||||
releaseJson = JSON.parse(data);
|
||||
} catch (error) {
|
||||
throw new Error('Failed to parse release JSON');
|
||||
}
|
||||
|
||||
// Type check
|
||||
if (isArrayOfBuilds(releaseJson)) {
|
||||
return releaseJson;
|
||||
} else {
|
||||
throw new Error('Release JSON is not of type Build[]');
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,14 @@
|
||||
* See 'LICENSE' in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
|
||||
export class InstallationInformation {
|
||||
export enum InstallationType {
|
||||
Online,
|
||||
Offline
|
||||
}
|
||||
|
||||
export class InstallationInformation {
|
||||
stage: string;
|
||||
type: InstallationType;
|
||||
hasError: boolean;
|
||||
telemetryProperties: { [key: string]: string };
|
||||
|
||||
@@ -14,19 +20,19 @@ export class InstallationInformation {
|
||||
}
|
||||
}
|
||||
|
||||
let installBlob: InstallationInformation ;
|
||||
let installBlob: InstallationInformation;
|
||||
|
||||
export function initializeInstallationInformation(): void {
|
||||
installBlob = new InstallationInformation ();
|
||||
}
|
||||
|
||||
export function getInstallationInformationInstance(): InstallationInformation {
|
||||
export function getInstallationInformation(): InstallationInformation {
|
||||
if (!installBlob) {
|
||||
installBlob = new InstallationInformation();
|
||||
}
|
||||
return installBlob;
|
||||
}
|
||||
|
||||
export function setInstallationStage(stage: string): void {
|
||||
if (!installBlob) {
|
||||
initializeInstallationInformation();
|
||||
}
|
||||
installBlob.stage = stage;
|
||||
}
|
||||
getInstallationInformation().stage = stage;
|
||||
}
|
||||
|
||||
export function setInstallationType(type: InstallationType): void {
|
||||
getInstallationInformation().type = type;
|
||||
}
|
||||
|
||||
@@ -36,13 +36,13 @@ export class Logger {
|
||||
|
||||
public showInformationMessage(message: string, items?: string[]): Thenable<string> {
|
||||
this.appendLine(message);
|
||||
|
||||
|
||||
return vscode.window.showInformationMessage(message, ...items);
|
||||
}
|
||||
|
||||
public showWarningMessage(message: string, items?: string[]): Thenable<string> {
|
||||
this.appendLine(message);
|
||||
|
||||
|
||||
return vscode.window.showWarningMessage(message, ...items);
|
||||
}
|
||||
|
||||
@@ -73,4 +73,4 @@ export function getOutputChannelLogger(): Logger {
|
||||
outputChannelLogger = new Logger(message => getOutputChannel().append(message));
|
||||
}
|
||||
return outputChannelLogger;
|
||||
}
|
||||
}
|
||||
|
||||
+93
-45
@@ -13,27 +13,38 @@ import * as Telemetry from './telemetry';
|
||||
import * as util from './common';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
import { CppToolsApi, CppToolsExtension } from 'vscode-cpptools';
|
||||
import { getTemporaryCommandRegistrarInstance, initializeTemporaryCommandRegistrar } from './commands';
|
||||
import { PlatformInformation } from './platform';
|
||||
import { PackageManager, PackageManagerError, PackageManagerWebResponseError, IPackage } from './packageManager';
|
||||
import { PersistentState } from './LanguageServer/persistentState';
|
||||
import { initializeInstallationInformation, getInstallationInformationInstance, InstallationInformation, setInstallationStage } from './installationInformation';
|
||||
import { PackageManager, PackageManagerError, IPackage } from './packageManager';
|
||||
import { getInstallationInformation, InstallationInformation, setInstallationStage, setInstallationType, InstallationType } from './installationInformation';
|
||||
import { Logger, getOutputChannelLogger, showOutputChannel } from './logger';
|
||||
import { CppTools } from './cppTools';
|
||||
import { CppToolsApi } from './api';
|
||||
import { CppTools1, NullCppTools } from './cppTools1';
|
||||
|
||||
const releaseNotesVersion: number = 3;
|
||||
const cppTools: CppTools = new CppTools();
|
||||
const cppTools: CppTools1 = new CppTools1();
|
||||
let languageServiceDisabled: boolean = false;
|
||||
let reloadMessageShown: boolean = false;
|
||||
let disposables: vscode.Disposable[] = [];
|
||||
|
||||
export async function activate(context: vscode.ExtensionContext): Promise<CppToolsApi & CppToolsExtension> {
|
||||
let errMsg: string = "";
|
||||
if (process.arch !== 'ia32' && process.arch !== 'x64') {
|
||||
errMsg = "Architecture " + String(process.arch) + " is not supported. ";
|
||||
} else if (process.platform === 'linux' && fs.existsSync('/etc/alpine-release')) {
|
||||
errMsg = "Alpine containers are not supported. ";
|
||||
}
|
||||
if (errMsg) {
|
||||
vscode.window.showErrorMessage(errMsg);
|
||||
return new NullCppTools();
|
||||
}
|
||||
|
||||
export async function activate(context: vscode.ExtensionContext): Promise<CppToolsApi> {
|
||||
initializeTemporaryCommandRegistrar();
|
||||
util.setExtensionContext(context);
|
||||
initializeTemporaryCommandRegistrar();
|
||||
Telemetry.activate();
|
||||
util.setProgress(0);
|
||||
initializeInstallationInformation();
|
||||
|
||||
// Initialize the DebuggerExtension and register the related commands and providers.
|
||||
DebuggerExtension.initialize();
|
||||
DebuggerExtension.initialize(context);
|
||||
|
||||
await processRuntimeDependencies();
|
||||
|
||||
@@ -43,6 +54,11 @@ export async function activate(context: vscode.ExtensionContext): Promise<CppToo
|
||||
export function deactivate(): Thenable<void> {
|
||||
DebuggerExtension.dispose();
|
||||
Telemetry.deactivate();
|
||||
disposables.forEach(d => d.dispose());
|
||||
|
||||
if (languageServiceDisabled) {
|
||||
return;
|
||||
}
|
||||
return LanguageServer.deactivate();
|
||||
}
|
||||
|
||||
@@ -57,23 +73,30 @@ async function processRuntimeDependencies(): Promise<void> {
|
||||
} catch (error) {
|
||||
getOutputChannelLogger().showErrorMessage('The installation of the C/C++ extension failed. Please see the output window for more information.');
|
||||
showOutputChannel();
|
||||
|
||||
// Send the failure telemetry since postInstall will not be called.
|
||||
sendTelemetry(await PlatformInformation.GetPlatformInformation());
|
||||
}
|
||||
// The extension have been installed and activated before.
|
||||
} else {
|
||||
// The extension has been installed and activated before.
|
||||
await finalizeExtensionActivation();
|
||||
}
|
||||
// No lock file, need to download and install dependencies.
|
||||
} else {
|
||||
// No lock file, need to download and install dependencies.
|
||||
try {
|
||||
await onlineInstallation();
|
||||
} catch (error) {
|
||||
handleError(error);
|
||||
|
||||
// Send the failure telemetry since postInstall will not be called.
|
||||
sendTelemetry(await PlatformInformation.GetPlatformInformation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function offlineInstallation(): Promise<void> {
|
||||
setInstallationStage('getPlatformInfo');
|
||||
setInstallationType(InstallationType.Offline);
|
||||
const info: PlatformInformation = await PlatformInformation.GetPlatformInformation();
|
||||
|
||||
setInstallationStage('makeBinariesExecutable');
|
||||
@@ -94,6 +117,7 @@ async function offlineInstallation(): Promise<void> {
|
||||
|
||||
async function onlineInstallation(): Promise<void> {
|
||||
setInstallationStage('getPlatformInfo');
|
||||
setInstallationType(InstallationType.Online);
|
||||
const info: PlatformInformation = await PlatformInformation.GetPlatformInformation();
|
||||
|
||||
await downloadAndInstallPackages(info);
|
||||
@@ -173,23 +197,12 @@ function touchInstallLockFile(): Promise<void> {
|
||||
}
|
||||
|
||||
function handleError(error: any): void {
|
||||
let installationInformation: InstallationInformation = getInstallationInformationInstance();
|
||||
let installationInformation: InstallationInformation = getInstallationInformation();
|
||||
installationInformation.hasError = true;
|
||||
installationInformation.telemetryProperties['stage'] = installationInformation.stage;
|
||||
let errorMessage: string;
|
||||
|
||||
if (error instanceof PackageManagerError) {
|
||||
// If this is a WebResponse error, log the IP that it resolved from the package URL
|
||||
if (error instanceof PackageManagerWebResponseError) {
|
||||
let webRequestPackageError: PackageManagerWebResponseError = error;
|
||||
if (webRequestPackageError.socket) {
|
||||
let address: any = webRequestPackageError.socket.address();
|
||||
if (address) {
|
||||
installationInformation.telemetryProperties['error.targetIP'] = address.address + ':' + address.port;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let packageError: PackageManagerError = error;
|
||||
|
||||
installationInformation.telemetryProperties['error.methodName'] = packageError.methodName;
|
||||
@@ -228,10 +241,11 @@ function handleError(error: any): void {
|
||||
}
|
||||
|
||||
function sendTelemetry(info: PlatformInformation): boolean {
|
||||
let installBlob: InstallationInformation = getInstallationInformationInstance();
|
||||
let installBlob: InstallationInformation = getInstallationInformation();
|
||||
const success: boolean = !installBlob.hasError;
|
||||
|
||||
installBlob.telemetryProperties['success'] = success.toString();
|
||||
installBlob.telemetryProperties['type'] = installBlob.type === InstallationType.Online ? "online" : "offline";
|
||||
|
||||
if (info.distribution) {
|
||||
installBlob.telemetryProperties['linuxDistroName'] = info.distribution.name;
|
||||
@@ -240,11 +254,6 @@ function sendTelemetry(info: PlatformInformation): boolean {
|
||||
|
||||
if (success) {
|
||||
util.setProgress(util.getProgressInstallSuccess());
|
||||
let versionShown: PersistentState<number> = new PersistentState<number>("CPP.ReleaseNotesVersion", -1);
|
||||
if (versionShown.Value < releaseNotesVersion) {
|
||||
util.showReleaseNotes();
|
||||
versionShown.Value = releaseNotesVersion;
|
||||
}
|
||||
}
|
||||
|
||||
installBlob.telemetryProperties['osArchitecture'] = info.architecture;
|
||||
@@ -266,7 +275,7 @@ async function postInstall(info: PlatformInformation): Promise<void> {
|
||||
if (!installSuccess) {
|
||||
return Promise.reject<void>("");
|
||||
} else {
|
||||
// Notify user's if debugging may not be supported on their OS.
|
||||
// Notify users if debugging may not be supported on their OS.
|
||||
util.checkDistro(info);
|
||||
|
||||
return finalizeExtensionActivation();
|
||||
@@ -274,14 +283,33 @@ async function postInstall(info: PlatformInformation): Promise<void> {
|
||||
}
|
||||
|
||||
async function finalizeExtensionActivation(): Promise<void> {
|
||||
if (vscode.workspace.getConfiguration("C_Cpp", null).get<string>("intelliSenseEngine") === "Disabled") {
|
||||
languageServiceDisabled = true;
|
||||
getTemporaryCommandRegistrarInstance().disableLanguageServer();
|
||||
disposables.push(vscode.workspace.onDidChangeConfiguration(() => {
|
||||
if (!reloadMessageShown && vscode.workspace.getConfiguration("C_Cpp", null).get<string>("intelliSenseEngine") !== "Disabled") {
|
||||
reloadMessageShown = true;
|
||||
util.promptForReloadWindowDueToSettingsChange();
|
||||
}
|
||||
}));
|
||||
return;
|
||||
}
|
||||
disposables.push(vscode.workspace.onDidChangeConfiguration(() => {
|
||||
if (!reloadMessageShown && vscode.workspace.getConfiguration("C_Cpp", null).get<string>("intelliSenseEngine") === "Disabled") {
|
||||
reloadMessageShown = true;
|
||||
util.promptForReloadWindowDueToSettingsChange();
|
||||
}
|
||||
}));
|
||||
getTemporaryCommandRegistrarInstance().activateLanguageServer();
|
||||
|
||||
// Update default for C_Cpp.intelliSenseEngine based on A/B testing settings.
|
||||
// (this may result in rewriting the package.json file)
|
||||
|
||||
|
||||
let abTestSettings: cpptoolsJsonUtils.ABTestSettings = cpptoolsJsonUtils.getABTestSettings();
|
||||
let packageJson: any = util.getRawPackageJson();
|
||||
if (util.packageJson.extensionLocation && !util.packageJson.extensionLocation.path.includes(".vscode-insiders")) {
|
||||
let writePackageJson: boolean = false;
|
||||
let packageJsonPath: string = util.getExtensionFilePath("package.json");
|
||||
if (!packageJsonPath.includes(".vscode-insiders") && !packageJsonPath.includes(".vscode-exploration")) {
|
||||
let prevIntelliSenseEngineDefault: any = packageJson.contributes.configuration.properties["C_Cpp.intelliSenseEngine"].default;
|
||||
if (abTestSettings.UseDefaultIntelliSenseEngine) {
|
||||
packageJson.contributes.configuration.properties["C_Cpp.intelliSenseEngine"].default = "Default";
|
||||
@@ -289,36 +317,56 @@ async function finalizeExtensionActivation(): Promise<void> {
|
||||
packageJson.contributes.configuration.properties["C_Cpp.intelliSenseEngine"].default = "Tag Parser";
|
||||
}
|
||||
if (prevIntelliSenseEngineDefault !== packageJson.contributes.configuration.properties["C_Cpp.intelliSenseEngine"].default) {
|
||||
return util.writeFileText(util.getPackageJsonPath(), util.stringifyPackageJson(packageJson));
|
||||
writePackageJson = true;
|
||||
}
|
||||
} else {
|
||||
if (packageJson.contributes.configuration.properties['C_Cpp.updateChannel'].default === 'Default') {
|
||||
packageJson.contributes.configuration.properties['C_Cpp.updateChannel'].default = 'Insiders';
|
||||
writePackageJson = true;
|
||||
}
|
||||
}
|
||||
|
||||
let prevEnhancedColorizationDefault: any = packageJson.contributes.configuration.properties["C_Cpp.enhancedColorization"].default;
|
||||
if (abTestSettings.UseEnhancedColorization) {
|
||||
packageJson.contributes.configuration.properties["C_Cpp.enhancedColorization"].default = "Enabled";
|
||||
} else {
|
||||
packageJson.contributes.configuration.properties["C_Cpp.enhancedColorization"].default = "Disabled";
|
||||
}
|
||||
if (prevEnhancedColorizationDefault !== packageJson.contributes.configuration.properties["C_Cpp.enhancedColorization"].default) {
|
||||
writePackageJson = true;
|
||||
}
|
||||
|
||||
if (writePackageJson) {
|
||||
return util.writeFileText(util.getPackageJsonPath(), util.stringifyPackageJson(packageJson));
|
||||
}
|
||||
}
|
||||
|
||||
function rewriteManifest(): Promise<void> {
|
||||
// Replace activationEvents with the events that the extension should be activated for subsequent sessions.
|
||||
let packageJson: any = util.getRawPackageJson();
|
||||
|
||||
|
||||
packageJson.activationEvents = [
|
||||
"onLanguage:cpp",
|
||||
"onLanguage:c",
|
||||
"onCommand:extension.pickNativeProcess",
|
||||
"onCommand:extension.pickRemoteNativeProcess",
|
||||
"onCommand:C_Cpp.ConfigurationEdit",
|
||||
"onCommand:C_Cpp.BuildAndDebugActiveFile",
|
||||
"onCommand:C_Cpp.ConfigurationEditJSON",
|
||||
"onCommand:C_Cpp.ConfigurationEditUI",
|
||||
"onCommand:C_Cpp.ConfigurationSelect",
|
||||
"onCommand:C_Cpp.ConfigurationProviderSelect",
|
||||
"onCommand:C_Cpp.SwitchHeaderSource",
|
||||
"onCommand:C_Cpp.Navigate",
|
||||
"onCommand:C_Cpp.GoToDeclaration",
|
||||
"onCommand:C_Cpp.PeekDeclaration",
|
||||
"onCommand:C_Cpp.ToggleErrorSquiggles",
|
||||
"onCommand:C_Cpp.EnableErrorSquiggles",
|
||||
"onCommand:C_Cpp.DisableErrorSquiggles",
|
||||
"onCommand:C_Cpp.ToggleIncludeFallback",
|
||||
"onCommand:C_Cpp.ToggleDimInactiveRegions",
|
||||
"onCommand:C_Cpp.ToggleSnippets",
|
||||
"onCommand:C_Cpp.ShowReleaseNotes",
|
||||
"onCommand:C_Cpp.ResetDatabase",
|
||||
"onCommand:C_Cpp.PauseParsing",
|
||||
"onCommand:C_Cpp.ResumeParsing",
|
||||
"onCommand:C_Cpp.ShowParsingCommands",
|
||||
"onCommand:C_Cpp.TakeSurvey",
|
||||
"onCommand:C_Cpp.LogDiagnostics",
|
||||
"onCommand:C_Cpp.RescanWorkspace",
|
||||
"onCommand:C_Cpp.VcpkgClipboardInstallSuggested",
|
||||
"onCommand:C_Cpp.VcpkgClipboardOnlineHelpSuggested",
|
||||
"onDebug",
|
||||
"workspaceContains:/.vscode/c_cpp_properties.json"
|
||||
];
|
||||
|
||||
@@ -36,7 +36,7 @@ export interface IPackage {
|
||||
binaries: string[];
|
||||
|
||||
// Internal location to which the package was downloaded
|
||||
tmpFile: tmp.SyncResult;
|
||||
tmpFile: tmp.FileResult;
|
||||
}
|
||||
|
||||
export class PackageManagerError extends Error {
|
||||
@@ -151,23 +151,23 @@ export class PackageManager {
|
||||
|
||||
progress.report({message: `Downloading ${progressCount}: ${pkg.description}`});
|
||||
|
||||
const tmpResult: tmp.SyncResult = await this.CreateTempFile(pkg);
|
||||
const tmpResult: tmp.FileResult = await this.CreateTempFile(pkg);
|
||||
await this.DownloadPackageWithRetries(pkg, tmpResult, progress);
|
||||
}
|
||||
|
||||
private async CreateTempFile(pkg: IPackage): Promise<tmp.SyncResult> {
|
||||
return new Promise<tmp.SyncResult>((resolve, reject) => {
|
||||
private async CreateTempFile(pkg: IPackage): Promise<tmp.FileResult> {
|
||||
return new Promise<tmp.FileResult>((resolve, reject) => {
|
||||
tmp.file({ prefix: "package-" }, (err, path, fd, cleanupCallback) => {
|
||||
if (err) {
|
||||
return reject(new PackageManagerError('Error from temp.file', 'DownloadPackage', pkg, err));
|
||||
}
|
||||
|
||||
return resolve(<tmp.SyncResult>{ name: path, fd: fd, removeCallback: cleanupCallback });
|
||||
return resolve(<tmp.FileResult>{ name: path, fd: fd, removeCallback: cleanupCallback });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private async DownloadPackageWithRetries(pkg: IPackage, tmpResult: tmp.SyncResult, progress: vscode.Progress<{message?: string; increment?: number}>): Promise<void> {
|
||||
private async DownloadPackageWithRetries(pkg: IPackage, tmpResult: tmp.FileResult, progress: vscode.Progress<{message?: string; increment?: number}>): Promise<void> {
|
||||
pkg.tmpFile = tmpResult;
|
||||
|
||||
let success: boolean = false;
|
||||
@@ -183,11 +183,10 @@ export class PackageManager {
|
||||
} catch (error) {
|
||||
retryCount += 1;
|
||||
lastError = error;
|
||||
if (retryCount >= MAX_RETRIES) {
|
||||
if (retryCount > MAX_RETRIES) {
|
||||
this.AppendChannel(` Failed to download ` + pkg.url);
|
||||
throw error;
|
||||
} else {
|
||||
// This will skip the success = true.
|
||||
this.AppendChannel(` Failed. Retrying...`);
|
||||
continue;
|
||||
}
|
||||
@@ -198,7 +197,7 @@ export class PackageManager {
|
||||
if (retryCount !== 0) {
|
||||
// Log telemetry to see if retrying helps.
|
||||
let telemetryProperties: { [key: string]: string } = {};
|
||||
telemetryProperties["success"] = `OnRetry${retryCount}`;
|
||||
telemetryProperties["success"] = success ? `OnRetry${retryCount}` : 'false';
|
||||
if (lastError instanceof PackageManagerError) {
|
||||
let packageError: PackageManagerError = lastError;
|
||||
telemetryProperties['error.methodName'] = packageError.methodName;
|
||||
@@ -334,7 +333,7 @@ export class PackageManager {
|
||||
|
||||
if (entry.fileName.endsWith("/")) {
|
||||
// Directory - create it
|
||||
mkdirp.mkdirp(absoluteEntryPath, { mode: 0o775 }, (err) => {
|
||||
mkdirp(absoluteEntryPath, { mode: 0o775 }, (err) => {
|
||||
if (err) {
|
||||
return reject(new PackageManagerError('Error creating directory', 'InstallPackage', pkg, err, err.code));
|
||||
}
|
||||
@@ -354,12 +353,12 @@ export class PackageManager {
|
||||
return reject(new PackageManagerError('Error in readStream', 'InstallPackage', pkg, err));
|
||||
});
|
||||
|
||||
mkdirp.mkdirp(path.dirname(absoluteEntryPath), { mode: 0o775 }, async (err) => {
|
||||
mkdirp(path.dirname(absoluteEntryPath), { mode: 0o775 }, async (err) => {
|
||||
if (err) {
|
||||
return reject(new PackageManagerError('Error creating directory', 'InstallPackage', pkg, err, err.code));
|
||||
}
|
||||
|
||||
// Create as a .tmp file to avoid partially unzipped files
|
||||
// Create as a .tmp file to avoid partially unzipped files
|
||||
// counting as completed files.
|
||||
let absoluteEntryTempFile: string = absoluteEntryPath + ".tmp";
|
||||
if (fs.existsSync(absoluteEntryTempFile)) {
|
||||
@@ -421,4 +420,4 @@ export class PackageManager {
|
||||
this.outputChannel.appendLine(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||
* See 'LICENSE' in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
|
||||
export class PackageVersion {
|
||||
major: number;
|
||||
minor: number;
|
||||
patch: number;
|
||||
suffix?: string;
|
||||
suffixVersion: number;
|
||||
|
||||
constructor(version: string) {
|
||||
const tokens: string[] = version.split(new RegExp('[-\\.]', 'g')); // Match against dots and dashes
|
||||
if (tokens.length < 3) {
|
||||
throw new Error('Failed to parse version string: ' + version);
|
||||
}
|
||||
|
||||
this.major = parseInt(tokens[0]);
|
||||
this.minor = parseInt(tokens[1]);
|
||||
this.patch = parseInt(tokens[2]);
|
||||
|
||||
if (tokens.length > 3) {
|
||||
const firstDigitOffset: number = tokens[3].search(new RegExp(/(\d)/)); // Find first occurrence of 0-9
|
||||
if (firstDigitOffset !== -1) {
|
||||
this.suffix = tokens[3].substring(0, firstDigitOffset);
|
||||
this.suffixVersion = parseInt(tokens[3].substring(firstDigitOffset));
|
||||
} else {
|
||||
this.suffix = tokens[3];
|
||||
this.suffixVersion = 1;
|
||||
}
|
||||
} else {
|
||||
this.suffix = undefined;
|
||||
this.suffixVersion = 0;
|
||||
}
|
||||
|
||||
if (this.major === undefined || this.minor === undefined || this.patch === undefined) {
|
||||
throw new Error('Failed to parse version string: ' + version);
|
||||
}
|
||||
}
|
||||
|
||||
public isGreaterThan(other: PackageVersion, suffixStr: string = 'insiders'): boolean {
|
||||
if ((this.suffix && !this.suffix.startsWith(suffixStr)) || (other.suffix && !other.suffix.startsWith(suffixStr))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let diff: number = this.major - other.major;
|
||||
if (diff) {
|
||||
return diff > 0;
|
||||
} else {
|
||||
diff = this.minor - other.minor;
|
||||
if (diff) {
|
||||
return diff > 0;
|
||||
} else {
|
||||
diff = this.patch - other.patch;
|
||||
if (diff) {
|
||||
return diff > 0;
|
||||
} else if (this.suffix) {
|
||||
return (other.suffix && this.suffixVersion > other.suffixVersion);
|
||||
} else {
|
||||
return other.suffix ? true : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user