Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

highlight the code, based on preprocessor definitions #510

Closed
amigo421 opened this issue Feb 20, 2017 · 24 comments

Comments

Projects
None yet
7 participants
@amigo421
Copy link

commented Feb 20, 2017

is it possible to implement like this does most of IDEs:
grayed (or other highlightiing) the code blocks of inactive preprocessor definitions.
look at the screenshot to understand what I mean
image

@sean-mcmanus

This comment has been minimized.

Copy link
Collaborator

commented Feb 21, 2017

VS Code doesn't provide any interface for the C++ extension to report which range of text is inactive and we don't control any of the colorization (it's done by atom/language-c), so I don't think this is currently possible.

@amigo421

This comment has been minimized.

Copy link
Author

commented Mar 5, 2017

seems that is possible,
please look at the linked request in vscode repository,
the reply there refers to the API for the discussed feature

@sean-mcmanus

This comment has been minimized.

Copy link
Collaborator

commented Mar 8, 2017

Ok, but showing inactive regions will have to wait till after we add the IntelliSense engine (which processes #define/#ifdef).

@amigo421

This comment has been minimized.

Copy link
Author

commented Mar 8, 2017

thank you!

@agauniyal

This comment has been minimized.

Copy link

commented Mar 23, 2017

@sean-mcmanus when can we expect that engine? any dates or some hope 😅

@sean-mcmanus

This comment has been minimized.

Copy link
Collaborator

commented Mar 23, 2017

We're planning to release some IntelliSense engine-based features in April, but it won't include "inactive regions", which we don't have any schedule for yet.

@amigo421

This comment has been minimized.

Copy link
Author

commented Mar 24, 2017

good news , thank you! (I'm about intellisense)

@bobbrow

This comment has been minimized.

Copy link
Member

commented Jul 6, 2017

Merging this issue with #230

@bobbrow bobbrow closed this Jul 6, 2017

@bigwave-in-boulder

This comment has been minimized.

Copy link

commented Feb 15, 2018

Any update to this?

@sean-mcmanus

This comment has been minimized.

Copy link
Collaborator

commented Feb 15, 2018

@bigwave-in-boulder Yeah, we should be releasing the feature today in 0.15.0 (and the feature has been in the 0.15.0-insiders release for 2 weeks: https://github.com/Microsoft/vscode-cpptools/releases/tag/v0.15.0-insiders ).

@sean-mcmanus

This comment has been minimized.

Copy link
Collaborator

commented Feb 15, 2018

@amigo421 @agauniyal @bigwave-in-boulder Inactive region highlighting has been added with 0.15.0.

@ghost

This comment has been minimized.

Copy link

commented Feb 16, 2018

How do you disable this feature now ! I have many defined that are passed by makefile ! Now 80% of my code is grey.....

@sean-mcmanus

This comment has been minimized.

Copy link
Collaborator

commented Feb 16, 2018

@Darkstarxt You can set intelliSenseEngine to "Tag Parser". You could also follow the steps at #1466 (comment). However -- if you see gray text, it means the code is not visible to the IntelliSense engine, so you won't get any of those features for that section of code.

@WeiZRPW

This comment has been minimized.

Copy link

commented Aug 25, 2018

@sean-mcmanus , I installed IntelliSense on my Visual Studio. I have defined a few macros (.e.g., OPENCV and CUDA etc) in Makefile and I use task.json to call my Makefile to build the project. Now the problem is that VSCode could not recognize all my macros defined in Makefile. See the below screenshot. I actually defined OPENCV in Makefile but VSCode could not recognize it thus lines 16 and below are shown as inactive. I wonder if there is a solution to overcome this issue.

####################################task.json####################################
{
"version": "2.0.0",
"tasks": [
{
"label": "darknetMakefile",
"type": "shell",
"command": "make",
"options": {
"cwd": "/home/xxx/workdir/"
},
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
},
"args": [
"QUIET=0"
],
"problemMatcher": {
"owner": "cpp",
"fileLocation": [
"absolute"
],
"pattern": {
"regexp": "^(.):(\d+):(\d+):\s+(warning|error):\s+(.)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
]
}
####################################task.json####################################

screenshot from 2018-08-24 19-17-47

@bobbrow

This comment has been minimized.

Copy link
Member

commented Aug 27, 2018

@Iamthegeekdavid, tasks.json is not used by IntelliSense. Take a look at c_cpp_properties.json (you can use the "Edit Configurations..." command to open it). There is a property in the configuration called defines where you can add macros that should be applied for IntelliSense.

Full reference here: https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/c_cpp_properties.json.md

@WeiZRPW

This comment has been minimized.

Copy link

commented Aug 28, 2018

@bobbrow the pre-defined MACRO feature is good on my VSCode now. I wonder if c_cpp_properties.json only affect the code displaying but will not impact building my project, i.e., code compiling and linking.
Thanks,

@bobbrow

This comment has been minimized.

Copy link
Member

commented Aug 28, 2018

Correct, c_cpp_properties.json is just for IntelliSense, not for compiling or linking.

@WeiZRPW

This comment has been minimized.

Copy link

commented Sep 25, 2018

@bobbrow , hi Bob, one more question. I found that "debug disabled for cuda code in vscode". I wrote one issue about it: kriegalex/vscode-cuda#4 Nobody replies yet. I wonder if you have any clue on this. Thanks,

@bobbrow

This comment has been minimized.

Copy link
Member

commented Oct 1, 2018

I'm sorry, I don't know anything about that extension.

@WeiZRPW

This comment has been minimized.

Copy link

commented Oct 1, 2018

@bobbrow , thanks for replying my message. I know that Visual Studio has a debugging tool, parallel stack, which show a hierarchical graph of all running threads. I wonder if VSCode has this feature or will have it in the future. Thanks again!

@sean-mcmanus

This comment has been minimized.

Copy link
Collaborator

commented Oct 1, 2018

@Iamthegeekdavid VS Code and the C/C++ extension doesn't implement the parallel stacks feature -- you could open a feature request for that.

@WeiZRPW

This comment has been minimized.

Copy link

commented Oct 3, 2018

@sean-mcmanus , thanks for replying my issue. For me to write feature request of parallel stack, shall I write a request on GitHub page of VSCode-cpptool (https://github.com/Microsoft/vscode-cpptools/issues) or VScode (https://github.com/Microsoft/vscode/issues)? Thanks again!

@sean-mcmanus

This comment has been minimized.

Copy link
Collaborator

commented Oct 3, 2018

@Iamthegeekdavid I would try https://github.com/Microsoft/vscode-cpptools/issues first.

@WeiZRPW

This comment has been minimized.

Copy link

commented Oct 3, 2018

@sean-mcmanus , thanks. I have submitted a feature request there.
#2598

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.