Intellisense C++ file with alternative extension - visual-studio

Hi fellow programmers,
I have a C++ file with the extension .inc that is getting included from another C++ header. My problem is that the intellisense is inactive for this file, all the text just showing up black. I am using visual studio 2015. I have looked everywhere inside visual studio with no luck.
Is there any way to activate intellisense for this file?
Thanks in advance,
Jakob.

You need to tell VS that those .inc files are in fact C++.
Go to Tools -> Options -> Text Editor -> File Extension and add your .inc:
You need to restart Studio, at least for version 2013.

Related

Visual Studio dialog: You are renaming a script file

We keep getting the following dialog in Visual Studio when renaming files:
While I admire the effort of this option it simple doesn't work as intended and so we would like to disable this option.
My Google-fu hasn't been strong enough, does anybody know how to disable (or what extension produces) this option?
Thanks in advance!
I fixed this on my machine by going to Visual Studio -> Tools -> Options -> Projects and Solutions then uncheck the Prompt for symbolic renaming when renaming files checkbox.

Equivalent of Xcode "open-counterpart" feature in Visual Studio

I was working on Xcode for C++ development earlier and it's code editor had an option where when a header file was opened it would automatically open the .cpp on the assistant editor.
I am talking about this feature:
"How do I switch between the header and implementation file in Xcode 4?"
Now I have moved on to Visual Studio 2107. Though it is pretty intuitive in itself, I still miss this feature. Is there any feature similar to "open counterpart" in Visual Studio?
You can use my Tabs Studio extension with AutoOpener add-in enabled to automatically open corresponding .h or .cpp file.

How to Create Visual Studio 2013 Extension

I am interested to create a visual studio 2013 extension. I have gone through some of the msdn links. I am looking for adding one extra option when you right click on any .cs file/folder/project/solution, then on clicking that option some processing will be done on the .cs file/s. And lastly when the processing is done, the output should get print on a result window.
Edit -> Or May be Right Click -> Processing on .cs files -> open a windows form.
Similar to what happens when we do - Search/Replace in all files.
I know there are some options like - VSIX Project template, Editor templates, Visual Studio Package and Visual Studio Shell Isolated.
But i am not getting which one will help me out.
Any thoughts on this?
Thanks,
jash
I got the answer - we have to create a new VS package

visual studio right click missing find all refences and go to definition disabled

I am using Visual Studio 2010, suddenly from right click menu Go to Defination option is disabled and even F12 does not work. Find all referneces option is missing from the menu... i use them a lot, how can I get them work
I had the same problem with Microsoft Visual Studio 2013 Premium.
Fixed it by following the steps:
Close your solution.
Delete hidden .suo file in folder where your solution's .sln file exists.
Open your solution.
Rebuild your solution.
F12 should now work.
To reiterate what #eodabash said on 2014-04-07 was EXACTLY it.
I'm using Visual Studio 2013 Premium and I too lost Go To Definition functionality when the file was file containing the class was not opened.
Resolution:
Tools > Options > Text Editor > File Extension
Notice extension, "cs" was missing from list.
Type, "cs" in the Extension box
Select, "Microsoft Visual C#" under Editor
Click, Add. Click, Ok.
BOOM!
My issue was NOT an extension. It was NOT the .suo files. It was NOT a reinstall issue. It worked in C++ but NOT C#.
It WAS the file extensions option were not associated with C#. (facepalm)
I am working on a solution with C++ combined with C# which is set to VS 2010 compiler but I edit it with the 2013 IDE. All of this is orchestrated with the MS-TFS. I searched for both *.ncb and *.sou files but couldn't find them. Eventually I saw eodabash's comment of changing the File Extension option, and hey presto, it works for me...
Fortran is not listed in Tools > Options > Text Editor > File Extension, so this route did not work for me.
What worked for me was:
Tools > Options > Text Editor > Fortran > Advanced > Enable Find All References.
Set the above field to True. Also
Tools > Options > Text Editor > Fortran > Advanced > Enable Go To Definition.
This field may need to be changed to true.
For me, rebuilding the solution, then closing the file in visual studio and reopening it fixed it.
Verify the source file is part of the solution you have open. - Sigh.
(For me, I was looking for 'Go to Definition' for a source file in a completely different solution than what I had opened in Visual Studio. I opened the correct solution, verified 'Go To Definition' was functional, then grabbed a much needed cup of coffee.)

Can Visual Studio 2010 do ".inc" file syntax highlighting?

Can Visual Studio 2010 be configured to do syntax highlighting on ".inc" files? We have numerous large projects with tons of these ".inc" files (asp files) and so changing the file extension to ".asp" is not an option. All I want Visual Studio 2010 to do is treat these ".inc" files just like ".asp" files when it comes to syntax highlighting.
I've tried "Open With..." and selected the HTML Editor, which is the ".asp" default, but that did not work. I tried about every other editor in the list and none of them worked.
I know Notepad++ (among others) can do this, but I would prefer this be done in Visual Studio 2010 - using another IDE or text editor is not the answer I'm looking for here.
In Visual Studio...go to Options -> Text Editor -> File Extension. Type in 'inc' as extension and editor as 'Web Form Editor'. You may need to close then re-open your currently open .Inc pages...Hope this helps
I found both the 'Web Form Editor' and 'HTML Editor' to be less than ideal for me. Both of them appeared to highlight the syntax of the HTML ok, but the VBScript keywords were left in standard black text along with everything else.
While not ideal, I followed the instructions from the other answers, but substitude Visual Basic as the editor type and that worked much more to my liking (as they were include files, there is little HTML in them).
Options -> Text Editor -> File
Extension. Type in 'inc' as extension and set editor as 'Visual Basic'.
Close and re-open any '.inc' files and highlighting should be visible.
Antonio's solution worked for me. I did have to close and reopen files, but after I re-opened them the highlighting was visible. Thanks!
Options -> Text Editor -> File Extension.
Type in 'inc' as extension and set editor as 'Web Form Editor'.
Close and re-open any '.inc' files and highlighting should be visible.
Incidentally, this also works in Visual Studio 2005.
Use the File Extension, Text Editor, Options Dialog Box.
http://msdn.microsoft.com/en-us/library/4k7w5e5s.aspx
-update-
I see the same behavior :-( Will let you know if I find anything.
As a workaround, could you rename all your .inc files to .asp?
This has the added advantage that if a request is made for the inc file directly (highly unlikely but possible; and assuming you have the incs in the web directory), your code will be exposed unlike .asp where it is processed and rendered.
I really wanted to add a comment, because this is not a direct answer, but apparently you need 50 reputation for that.
I've found that in Visual Studio 2005 (again, in Tools -> Options -> Text Editor -> File Extension), both "Web Form Editor" and "User Control Editor" highlight both the HTML and the VBScript.
Amadiere mentioned that "Web Form Editor" doesn't highlight the VBScript in 2010, but maybe it's worth trying "User Control Editor", if that's an option in 2010.
In Visual Studio 2010 and 2012 Express it best works for me when I use "Microsoft Visual Basic" with my .inc files. Nevertheless, it's still not the same as with .asp files as there's no Autocomplete nor IntelliSense (Ctrl+Space, Ctrl+Shift+Space etc.) with the .inc files.
It should be made possible defining that .inc files are to be treated just as .asp files.
I agree with Purple Coder:
You should not name the files containing ASP code as .inc. It is a security risk. Anyone who knows/can guess the filename can open it in a browser and view the actual code inside the file.
But, first of all in my case this is an intranet page and therefore not very risky, as most people there would somehow find the files on the server anyway. I'm also not sure where this naming convention came from. It was there before I started. This was started on Visual Studio 6.
But, to avoid this risk there's a simple solution: add .inc in the Application Mapping of the IIS in the same manner as .asp.
You should not name the files containing ASP code as .inc. It is a security risk. Anyone who knows/can guess the filename can open it in a browser and view the actual code inside the file.

Resources