4

I have some .cs files in a C# project for VS2015, with Build Action = 'None', as these are to merged with a C#-template and are thus not valid .cs files at all, but having syntax highlighting is nice and I want to keep that.

However, I get a lot of Intellisense errors in the error list AND in the text editor (red squiggles), as these are just method bodies, more or less.

I'd like to keep showing Intellisense errors for files that are actually built, so setting Error List to "Build Only" isn't correct. (I still get red squiggles in the text editor, of course, and this is the annoying part.)

So:

  • Can I disable Intellisense for some files somehow?
  • Alternatively, can I enable C# syntax-highlighting only for another extension?
    (I can call these files .csmethod or something arbitrarily to avoid Intellisense triggering on them).

Note that if I enable syntax highlighting for .csmethod as per this question, I get Intellisense automagically :(

Macke
  • 24,812
  • 7
  • 82
  • 118
  • This looks like a duplicate? http://stackoverflow.com/questions/14468877/is-there-any-way-to-disable-intellisense-for-a-specific-project-namespace-wh – Kev_T Feb 28 '17 at 14:13
  • If the file is not being built directly, only after a merge, consider renaming the file to `MyFile.cs.merge` or something like that. This should exclude the file from intellisense scan. – Sergey Kalinichenko Feb 28 '17 at 14:15
  • @KevinTinnemans Almost, but this is truly file specific. – Macke Feb 28 '17 at 14:17
  • @dasblinkenlight I lose syntax highlighting then, which is worse than having Intellisense false flagging. :( – Macke Feb 28 '17 at 14:18
  • @Macke yeah I know, but I think the answer to that question applies to this question aswell – Kev_T Feb 28 '17 at 14:19
  • 2
    Possible duplicate of [Is there any way to disable intellisense for a specific project / namespace / whatever?](http://stackoverflow.com/questions/14468877/is-there-any-way-to-disable-intellisense-for-a-specific-project-namespace-wh) – Andrew Feb 28 '17 at 14:21
  • @Macke Syntax highlight is easier to re-enable, see [this Q&A](http://stackoverflow.com/a/25319912/335858). – Sergey Kalinichenko Feb 28 '17 at 14:34
  • @dasblinkenlight as per the update above, enabling syntax highlighting also enables intellisense. :( – Macke Mar 01 '17 at 11:50

0 Answers0