0

I'm working on a project at work, for which we're creating a VS plugin that will assist fellow developers in UI tasks for a rather large application. To that end, I've been tasked with creating an editor to provide some basic VS editor functionality (intellisense, code coloring, error highlighting, etc.) via Roslyn (Microsoft.CodeAnalysis.*).

I have the basic functionality completed with hard-coded colors & styles, but, if possible, I'd like to have the editor reflect the user's styling settings. I figure there's got to be some way to programmatically reference the VS code color settings, and reference that via the corresponding Microsoft.CodeAnalysis.Classification.ClassificationTypeNames returned by the Microsoft.CodeAnalysis.Classification.Classifier.GetClassifiedSpansAsync method.

I've been poking around, and have discovered the Microsoft.VisualStudio.Shell.VsColors service, but so far I'm not finding anything that looks like what I'm trying to find.

(Bonus points, if the solution includes the ability to apply the squiggly underlining for errors, etc.)

pfx
  • 20,323
  • 43
  • 37
  • 57
Theo Brinkman
  • 291
  • 2
  • 10
  • why don't you just use the shared editor component? – Daniel A. White Sep 14 '18 at 19:38
  • @DanielA.White What shared editor component? – Theo Brinkman Sep 17 '18 at 13:23
  • Resharper I think uses one provided by Visual Studio. Perhaps there is a way to use it – Daniel A. White Sep 17 '18 at 13:25
  • Are you looking for a way to get the theme of Visual Studio? If yes, you can check this: https://stackoverflow.com/questions/15920572/how-to-get-current-used-color-theme-of-visual-studio – Leo Liu Sep 18 '18 at 06:34
  • @DanielA.White, actually, if there's an editor control I can instantiate that would be great. It's actually one of the solutions I looked into first, but I couldn't find anything. Is there such a control available? How can I access it? – Theo Brinkman Sep 20 '18 at 13:49
  • https://learn.microsoft.com/en-us/visualstudio/extensibility/creating-custom-editors-and-designers?view=vs-2017 – Daniel A. White Sep 20 '18 at 13:56
  • I'm not sure that's quite going to do what I need it to. In my case, I need a single-line control that can be used within another control's layout (eg: inside a DevExpress PropertyGrid), not a full-blown editor window. The part of the tool I'm working on involves giving the user a clean method to set bindings/etc. on controls that will be dynamically created at runtime based on database entries. I will continue to look at that for a while, to see if I can make it work, but if you know how to set up a basic working sample, it could be a good answer. – Theo Brinkman Sep 20 '18 at 14:08

0 Answers0