Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Christopher Christou
@awschristou
Is it possible to start with an IVsHierarchy (x) for an arbitrarily selected item in the Solution Explorer and determine an IVsHierarchy (p) for the project that x belongs to? I'd like to understand how to do this without using EnvDTE. I've tried using GetProperty and __VSHPROPID.VSHPROPID_ParentHierarchy without success.
1 reply
nathvi
@nathvi

Hey guys, I've implemented this before using reflecting and attributes, but I'm curious if someone has done something like this before.

Basically, anytime a class implements an interface, visual studio autogenerates a static "IFactoryGenerator" class, and appropriate overridden "Create" methods.

The crude way I did it before was, reflect over the codebase for any class tagged with "CreateFactory" attribute, and then generate a "IFactoryGenerator" static class, with pass through implementations.
Jialong Cheng
@jialongcheng
@kcbanner_twitter Sorry for the late response. I didn't get any notifications either.
Let me try to understand the problem: it appears that the dialog (part of the async task scheduled with search) showed up early enough with either "Normal Priority" or the UIthreadBackgroundPriority. The issue is actually that the WPF redraw of the search results is non-deterministic when using Dispatcher.Normal priority. Is that correct? If so, the problem lies in WPF redraw, not the task scheduling part.
If the above assumption was correct, do you mind sharing how your draw the search results on the UI?
1 reply
simulan
@simulan
Hey guys
I've started creating my first visual studio extension, yet I have some problems with the databinding ("x:bind" or "{binding}") in xaml, does someone have a repo with an example using databinding in a visual studio extensions project?
simulan
@simulan
I solved it, so for people who are also having trouble I used this example, turns out I cant use "x:bind" in xaml and should use that "DataContext" property of the toolwindow : https://github.com/madskristensen/SolutionExtensions/blob/61334eb283be2314f9df48a5dfcf64578e00a51e/src/ExtensionManager/InstallerDialog.xaml.cs
Tri-Edge AI
@TriEdgeAI
I am using BaseCodeGeneratorWithSite, but is there an async version of this somewhere? My GenerateCode logic takes 200-300ms and it creates a really annoying lagspike everytime I hit Ctrl+S while editing the file, which I do all the time instinctively.
Help
josetr
@josetr

https://github.com/josetr/VsixTesting
VsixTesting allows you to easily create integration tests for your Visual Studio Extensions.

I just added support for Visual Studio 2022.

I've also created a pull request to properly initialize the Visual Studio Experimental Instance in the images used by GitHub Actions / Azure Pipelines to ensure that the integration tests execute very fast.
actions/virtual-environments#4143

The fastest way to try this library is by cloning https://github.com/josetr/VsixTestingSamples which also has been updated to support Visual Studio 2022.

Sorry for the ad. My previous message about it was more than 2 years ago tho.

Neil Henderson
@bluetarpmedia
@josetr Thanks for your excellent work on this, it's a great tool!
Aleksandr Danchenko
@aldanchenko
Hi team 👋, could someone say is there any available Git API for Visual Studio extensions?
2 replies
And another question: what is the best way to track file changes in Visual Studio solution?
3 replies
josetr
@josetr
@bluetarpmedia Thanks for the nice comment :thumbsup:
Christopher Long
@KingFruit85

Hi all, I've been having a go at making a VS extension however I'm totally new to .NET

I've got to the point where I can edit text in the active window using a command button, but what I would really like to do is highlight keywords in the active document in some fashion, like a squiggly underline or changing the colour of the font.

I've now hit a bit of a brick wall where I don't really know the terminology of what I should be searching for. Could anyone point me in the right direction of where I can start reading up on how to implement this sort of behaviour?

Many thanks

4 replies
Brien King
@BrienKing
I need to get a Type from a class that is defined in a project that is a Winforms application (not an Assembly)? Any suggestions on what I would need to do to get a list?
Erik Ejlskov Jensen
@ErikEJ
Just a heads up - you CAN have a single codebase and extension project (depending on your API usage) for VS 2017, VS2019 and VS 2022 - Watch https://youtu.be/NWp8Nkp0V4k?t=2858 and feel free to ping me for additional info
פנינה בוזגלו
@fany__cohen_twitter
i have problem with load this site https://bignews.co.il/ , i need defined class to be separate from api useage, i will be happy for example
Robert van der Hulst
@RobertvanderHulst
@BrienKing Have you tried Assembly.LoadFrom() or Mono.Cecil to load the EXE file ?
Robert van der Hulst
@RobertvanderHulst
Robert van der Hulst
@RobertvanderHulst
mattywilkinsoncsod
@mattywilkinsoncsod
Is there a way to have my Visual Studio Extension create and push to a remote git-based (BitBucket) repository when the associated project template is initialized and without any user interaction? I couldn't find any service offering a method to connect the project to a repository or to invoke a push with the built in Git source control functionality. I know I could probably spin off a shell and run commands there, but that means the user of the template also has to have git installed instead of just using the build in Visual Studio -> Git functionality
AaaBbb
@aaabbbcccddd00001111
Hi. I am developing an extension for a programming language. Is there a way to make Visual Studio does indentation for a new line after a left curly brace, like how it does for C# with smart indent?
AaaBbb
@aaabbbcccddd00001111
@josetr thanks
AaaBbb
@aaabbbcccddd00001111
I use StructureTag to get guide line and outline. I got the guide line but there is not outline. How do I get the outline for the structure?
This is the tag code in tagger GetTags method.
StructureTag tag;

tag = new StructureTag(snapshot, outliningSpan, headerSpan, null, null, PredefinedStructureTagTypes.Member, true);

yield return new TagSpanStructureTag(structureSpan, tag);
Arcanox
@ArcanoxDragon
what would cause VisualStudioWorkspace.OpenDocument to not work? It doesn't throw any exceptions or anything, it just simply doesn't open the document...
I've also tried DTE2.OpenFile with the full path to the file (which is a member of a project, which is a member of the opened solution) and that also does nothing.
Arcanox
@ArcanoxDragon
cool, VsShellUtilities.OpenDocument also does absolutely nothing. what gives?
Arcanox
@ArcanoxDragon
I've tried force-saving the solution and all projects before calling OpenDocument, I've tried adding an await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync() directly beforehand (even though I'm already on the UI thread), I've even tried looping 10 times with a 1-second delay between tries to see if it's some timing thing, and absolutely nothing happens. the workspace just sits there with no document open. I can copy the exact file path it's trying to open and use Ctrl+O to open it manually, and it opens the file as a member of the current solution (not a "miscellaneous file" or whatever), so it's definitely in the solution as a compilation unit. that shouldn't matter; I'd expect it to open any document you give it. It's just totally unresponsive.
Indu Prakash
@iprak
image.png
2 replies
Any idea how one can adjust the "No issues found" message at t he left-bottom of the document.
Vyacheslav Avdeev
@lsoft
@ArcanoxDragon I guess you can start from a new, empty, vsix and try to open something. if it successed, then copy stuff from your vsix to the new and check if opening works... and so on. no other ideas...
Jakub Míšek
@jakubmisek

Hello; does anybody know if there's currently some issue with icons in Project Hierarchy on VS 2022 Preview 3,4,5?

We're providing ImageManifest with both xaml and png (16x16) icons; they load and show well in project and item templates. However since DEV17 preview 3 they are not showing (just a blank space is displayed instead) in the project hierarchy (both in CPS extended with IProjectTreePropertiesProvider, and in old MPF where we provide IconMoniker through VSHPROPID_IconMoniker** properties)

Thank you for any hints.

Sergey-Vlasov
@Sergey-Vlasov

Anyone knows how to make projection buffers to work in VS 2022?

I reported this problem on Developer Community in August, but no answer so far:
https://developercommunity.visualstudio.com/t/Projection-buffer-shows-full-document-in/1510793?from=email&viewtype=all

1 reply
Aleksandr Danchenko
@aldanchenko
Hello, maybe someone know if it possible to handle unhandled exceptions in VS extension? I tried this approach:
Dispatcher.CurrentDispatcher.UnhandledException += this.App_DispatcherUnhandledException;
But no success.
7 replies
Michael Sawczyn
@msawczyn

So I've started looking at updating my extension, which is based on the Modeling SDK, to support VS2022. I've read the guidance on updating generic VSIX packages, but in the back of my mind I think of Modeling SDK projects as "special", they being such a nicely architected and tight framework.

Is there any guidance available (or coming up soon) to direct how to update these kinds of projects? Users are starting to ask more and more, and I'm feeling quite small not being able to give them an answer other than "yeah, I know ... I'm working on it".

AaaBbb
@aaabbbcccddd00001111
Hi. In VS 2019, how to make structure guide line tooltip uses existing classification result from an existing classification tagger that tagged the snapshot that has the text the tooltip displays?
baggiochen10
@baggiochen10
Dose anyone know how to add a source code file to the solution use VS extensions sdk?
6 replies
mattywilkinsoncsod
@mattywilkinsoncsod
Does Visual Studio not run dotnet template post actions? In my case, it works fine from dotnet CLI but Visual Studio displays the manualInstructions text instead. Does that mean it will never do it or just that I've got a particular configuration that it doesn't like.
1 reply
Alexander Gayko
@AdmiralSnyder
@ErikEJ hey, regarding having a single extension project for VS2019+2022, you're using the VS.SDK package v16 - is that necessary? i.e. how does it provide the required dlls for VS2017, in your case?
--> VS2019 complains about not getting Microsoft.VisualStudio.Shell.15.0, Version 17.0 - since that's not available there. is there an automagic fallback or will i need to dial the vssdk down maximally?
vraamark
@vraamark
I want to "draw" in the Solution Explorer tree view. Do anybody know how to or known of sample code that can do the same as Solution Error Visualizer (https://marketplace.visualstudio.com/items?itemName=VisualStudioPlatformTeam.SolutionErrorVisualizer)?
Steve Baker
@stkb
Hi will the marketplace support multiple VSIX's per extension listing when 2022 releases? Or do we have a date for that?
John Dhabolt
@dhabolt
Does anyone know if the NuGet window in Visual Studio can be extended, such as adding a button or data entry field and having access to the libraries being looked up?
3 replies
Steve Baker
@stkb
Is there any way to change the name/location of source.extension.vsixmanifest?
Antonín Procházka
@prochan2
Hi, this one is somwhere between this room and dotnet/roslyn, so I'd ask here too: Why are all the Microsoft.CodeAnalysis* NuGet packages of version 4.0.0 unlisted at NuGet.org and why there's no 4.0.0 version of Microsoft.VisualStudio.LanguageServices yet? Are these waiting for .NET Conf? It's confusing because VS 2022 is out already.
CyrusNajmabadi
@CyrusNajmabadi
@prochan2 please ask over at github.com/dotnet/roslyn.
Antonín Procházka
@prochan2
It's released now.
Antonín Procházka
@prochan2
Now I see that the package Microsoft.VisualStudio.ProjectSystem.SDK is still in preview.
simulan
@simulan
When using Community.VisualStudio.Toolkit to create my extension, I can easily get the solution path using solutions.getcurrentsolutionasync() & solution.FullPath, yet if the user would open a directory instead of an .sln in visual studio is there a way to get the base directory of what is opened?
7 replies