msbuild-project-tools-server icon indicating copy to clipboard operation
msbuild-project-tools-server copied to clipboard

Add help links for well-known elements

Open tintoy opened this issue 8 years ago • 50 comments

Includes elements such as Import, ItemGroup, PropertyGroup, etc. Also includes well-known tasks.

Relates to tintoy/msbuild-project-tools-server#4

tintoy avatar Apr 14 '18 04:04 tintoy

We can also have extension points so that Custom Sdks can have their own help files

like for my Sdk I can include <My.Custom.Sdk>\Docs folder to include my specific props/targets/tasks and for those Sdks that don't have their own Docs folder within their Sdk, We can have one from the Community, into the fallback folder like the one you have for Common props and targets!

I will update those help files in my repo for specific files and my sdk and test them and I'll include a PR later, if you are okay with this idea!

Nirmal4G avatar Apr 14 '18 08:04 Nirmal4G

Sure! Might be worth investigating whether there's an "official" way to package help for SDKs too? Or maybe we could add support for parsing XSDs to extract from there?

On Sat, 14 Apr. 2018, 6:02 pm Nirmal Guru, [email protected] wrote:

We can also have extension points so that Custom Sdks can have their own help files

like for my Sdk I can include <My.Custom.Sdk>\Docs folder to include my specific props/targets/tasks and for those Sdks that don't have their own Docs folder within their Sdk, We can have one from the Community, like the one you have for Common props and targets!

I will update those help files in my repo for specific files and my sdk and test them and I'll include a PR later, if you are okay with this idea!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tintoy/msbuild-project-tools-server/issues/5#issuecomment-381311933, or mute the thread https://github.com/notifications/unsubscribe-auth/ABkezIt_DSbzRS7o09OLtXqfAoY2Weboks5toa0qgaJpZM4TU6jq .

tintoy avatar Apr 14 '18 08:04 tintoy

The NuGet team proposed having docs along-side lib and ref folder but they killed the feature in-favour of having docs within lib or ref folder!

Now Sdks have becoming a thing I could ask NuGet team to include docs for Sdk packages, I will do that once my PoC works!

Nirmal4G avatar Apr 14 '18 08:04 Nirmal4G

CC: @Nirmal4G - the help links are working now; if I can build you a custom .vsix package would you be willing to try it out and provide feedback?

tintoy avatar Apr 21 '18 06:04 tintoy

Yes, I'd be happy too!

I'm already experimenting with help files coming from the SDKs!

Nirmal4G avatar Apr 21 '18 06:04 Nirmal4G

@Nirmal4G - here you go:

https://github.com/tintoy/msbuild-project-tools-server/releases/tag/v0.2.34

tintoy avatar Apr 21 '18 06:04 tintoy

You'll need to manually uninstall the existing extension and then install this one via the Install from VSIX menu item in the extension list.

tintoy avatar Apr 21 '18 06:04 tintoy

Element help is configured here.

tintoy avatar Apr 21 '18 06:04 tintoy

Ok, I installed it and the tools are successfully loading and logging in the window but I'm not getting any intellisense or hover contents!?

Nirmal4G avatar Apr 21 '18 06:04 Nirmal4G

Also getting this:

[Error - 12:08:09] Failed to provide completions.
System.ArgumentException: Argument cannot be null, empty, or entirely composed of whitespace: 'itemName'.
Parameter name: itemType
   at MSBuildProjectTools.LanguageServer.SemanticModel.MSBuildSchemaHelp.ForItemType(String itemType) in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.SemanticModel.MSBuild\MSBuildSchemaHelp.cs:line 335
   at MSBuildProjectTools.LanguageServer.CompletionProviders.ItemMetadataCompletion.<GetElementCompletions>d__5.MoveNext() in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\CompletionProviders\ItemMetadataCompletion.cs:line 231
   at System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1 enumerable)
   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
   at MSBuildProjectTools.LanguageServer.CompletionProviders.ItemMetadataCompletion.<ProvideCompletions>d__3.MoveNext() in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\CompletionProviders\ItemMetadataCompletion.cs:line 73
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at MSBuildProjectTools.LanguageServer.Handlers.CompletionHandler.<OnCompletion>d__27.MoveNext() in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Handlers\CompletionHandler.cs:line 193
[Error - 12:08:23] Failed to provide completions.
System.ArgumentException: Argument cannot be null, empty, or entirely composed of whitespace: 'itemName'.
Parameter name: itemType
   at MSBuildProjectTools.LanguageServer.SemanticModel.MSBuildSchemaHelp.ForItemType(String itemType) in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.SemanticModel.MSBuild\MSBuildSchemaHelp.cs:line 335
   at MSBuildProjectTools.LanguageServer.CompletionProviders.ItemMetadataCompletion.<GetElementCompletions>d__5.MoveNext() in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\CompletionProviders\ItemMetadataCompletion.cs:line 231
   at System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1 enumerable)
   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
   at MSBuildProjectTools.LanguageServer.CompletionProviders.ItemMetadataCompletion.<ProvideCompletions>d__3.MoveNext() in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\CompletionProviders\ItemMetadataCompletion.cs:line 73
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at MSBuildProjectTools.LanguageServer.Handlers.CompletionHandler.<OnCompletion>d__27.MoveNext() in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Handlers\CompletionHandler.cs:line 193

Nirmal4G avatar Apr 21 '18 06:04 Nirmal4G

Hmm, that's odd - sorry, roll back to the official release and I'll investigate in the meanwhile.

tintoy avatar Apr 21 '18 06:04 tintoy

Are you able to share the project XML where you saw this error?

tintoy avatar Apr 21 '18 07:04 tintoy

If not, can you turn the logging up to Verbose in the extension settings and post the full log when you get that error? From looking at the code, I'm not sure how that error could arise :-/

tintoy avatar Apr 21 '18 07:04 tintoy

The project is open source, It's here in the source folder of this MSBuild-Sdks repo!

Nirmal4G avatar Apr 21 '18 07:04 Nirmal4G

If not, can you turn the logging up to Verbose in the extension settings

How do I do that?

Nirmal4G avatar Apr 21 '18 07:04 Nirmal4G

No worries - if I can open the project file myself you don't need to :)

tintoy avatar Apr 21 '18 07:04 tintoy

It's dinner time here in Australia, but I'll have a look at this first thing tomorrow :) Thanks for trying it out so quickly BTW

tintoy avatar Apr 21 '18 07:04 tintoy

No problem, I'm working on these projects, anyway!

I can open the project file

Then you need to set env variable MSBuildSdksPath to point to the Source folder of the repo to pickup my custom SDKs

Nirmal4G avatar Apr 21 '18 07:04 Nirmal4G

@nirmal4G - was the location where you're seeing the error a PropertyGroupelement inside a Target element (rather than inside the root Project element by any chance? And does it happen with the currently-released version as well?

tintoy avatar Apr 22 '18 02:04 tintoy

(I have a theory but am not at my computer to check right now)

tintoy avatar Apr 22 '18 02:04 tintoy

Or the same pattern for an ItemGroup...

tintoy avatar Apr 22 '18 02:04 tintoy

One thing I've realised while looking into this issue is that PropertyGroup and ItemGroup elements appearing inside Target elements are currently not entirely visible to the project system (because they are only evaluated when the target is built).

It's still possible to parse them (but not to evaluate them) if we extend the semantic model (MSBuildObject and its inheritors) to capture the required information from:

Although we'll need to do a bit more work to match them back up to their originating XML elements to get intellisense working because ProjectPropertyGroupTaskInstance / ProjectItemGroupTaskInstance don't expose that information the way ProjectProperty / ProjectItem do.

tintoy avatar Apr 22 '18 03:04 tintoy

We can probably get the information we need via Microsoft.Build.Evaluation.Project::Xml (which is a Microsoft.Build.Construction.ProjectRootElement) which enables us to scan for all PropertyGroup / ItemGroup XML elements within Target elements.

One thing we may need to watch for is whether this additional scanning has a performance impact; I'm hoping not, but we'll have to see.

tintoy avatar Apr 22 '18 03:04 tintoy

@Nirmal4G - which project file, specifically, were you having problems with? I've tried opening a couple of the files in your project, and I get full intellisense (completions and tooltips-on-hover).

tintoy avatar Apr 22 '18 03:04 tintoy

which project file, specifically, were you having problems with?

*.nuproj and custom SDK based (*.*proj) projects

Nirmal4G avatar Apr 22 '18 11:04 Nirmal4G

was the location where you're seeing the error a PropertyGroupelement inside a Target element (rather than inside the root Project element by any chance? And does it happen with the currently-released version as well?

No Target element. Although now that you mention it, the same problem which was happening inside the project root element with SDK attribute defined (with a custom value), is happening inside the target element as well. Nice find!

Nirmal4G avatar Apr 22 '18 11:04 Nirmal4G

Thanks, will give it a try in an hour or so

tintoy avatar Apr 22 '18 17:04 tintoy

BTW, how are you overriding the msbuild extensions path? Via environment variable?

tintoy avatar Apr 22 '18 17:04 tintoy

Oops, you did already say how - sorry only just woke up about 15 mins ago :)

tintoy avatar Apr 22 '18 17:04 tintoy

BTW, have you seen this? https://docs.microsoft.com/en-us/visualstudio/msbuild/how-to-use-project-sdk

tintoy avatar Apr 22 '18 17:04 tintoy