Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add help links for well-known elements #5

Open
tintoy opened this issue Apr 14, 2018 · 50 comments
Open

Add help links for well-known elements #5

tintoy opened this issue Apr 14, 2018 · 50 comments

Comments

@tintoy
Copy link
Owner

tintoy commented Apr 14, 2018

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

Relates to #4

tintoy added a commit that referenced this issue Apr 14, 2018
tintoy added a commit to tintoy/msbuild-project-tools-vscode that referenced this issue Apr 14, 2018
tintoy added a commit to tintoy/msbuild-project-tools-vscode that referenced this issue Apr 14, 2018
tintoy added a commit to tintoy/msbuild-project-tools-vscode that referenced this issue Apr 14, 2018
@Nirmal4G
Copy link

Nirmal4G commented Apr 14, 2018

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!

@tintoy
Copy link
Owner Author

tintoy commented Apr 14, 2018 via email

@Nirmal4G
Copy link

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!

tintoy added a commit to tintoy/msbuild-project-tools-vscode that referenced this issue Apr 20, 2018
tintoy added a commit that referenced this issue Apr 20, 2018
tintoy added a commit to tintoy/msbuild-project-tools-vscode that referenced this issue Apr 20, 2018
tintoy added a commit that referenced this issue Apr 21, 2018
tintoy added a commit to tintoy/msbuild-project-tools-vscode that referenced this issue Apr 21, 2018
@tintoy
Copy link
Owner Author

tintoy commented Apr 21, 2018

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?

@Nirmal4G
Copy link

Yes, I'd be happy too!

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

tintoy added a commit that referenced this issue Apr 21, 2018
…wn MSBuild XML elements that don't directly correspond to MSBuild objects

#5
@tintoy
Copy link
Owner Author

tintoy commented Apr 21, 2018

@Nirmal4G - here you go:

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

@tintoy
Copy link
Owner Author

tintoy commented Apr 21, 2018

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
Copy link
Owner Author

tintoy commented Apr 21, 2018

Element help is configured here.

@Nirmal4G
Copy link

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
Copy link

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

@tintoy
Copy link
Owner Author

tintoy commented Apr 21, 2018

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

@tintoy
Copy link
Owner Author

tintoy commented Apr 21, 2018

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

@Nirmal4G
Copy link

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!

@tintoy
Copy link
Owner Author

tintoy commented Apr 22, 2018

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

@tintoy
Copy link
Owner Author

tintoy commented Apr 22, 2018

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

@tintoy
Copy link
Owner Author

tintoy commented Apr 22, 2018

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

@tintoy
Copy link
Owner Author

tintoy commented Apr 22, 2018

@tintoy
Copy link
Owner Author

tintoy commented Apr 22, 2018

@Nirmal4G - do you still get those errors if, instead of changing the MSBuildSdksPath environment variable, you copy those SDK folders into C:\Program Files\dotnet\Sdk\<current-dotnet-sdk-version> ?

@tintoy
Copy link
Owner Author

tintoy commented Apr 22, 2018

BTW, I tried following your instructions above ($env:MSBuildSdksPath = 'D:\Development\github\nirin\msbuild-sdks\Source') and then running VS Code and opening your project, but I still can't see any errors when opening (or using intellisense in) any of the files in your project.

Sorry to be a pain, but is there any chance you could list an exact series of steps to replicate the issue? I just want to make sure we're doing exactly the same thing :)

@tintoy
Copy link
Owner Author

tintoy commented Apr 22, 2018

Oh, and while it's not implemented yet, tintoy/msbuild-project-tools-vscode#35 (comment) will make it a lot easier to override the extensions directory.

@Nirmal4G
Copy link

Nirmal4G commented Apr 22, 2018

Sorry to be a pain, but is there any chance you could list an exact series of steps to replicate the issue? I just want to make sure we're doing exactly the same thing

No problem. you are helping me a lot with your extension, It's not at all a PAIN!

  1. You could override User env variables by going to System Properties control panel (that's how I'm doing it) But you have to login and logoff every time you set the path! (Now that's PAIN 😉🤣 )

  2. Open CMD (admin/normal mode - your choice), set the env variable and open code to that directory within that CMD.

Comments related to SDK style project configuration

Since these are not released into public they are not in the NuGet or MyGet for the NuGetSdkReolver to fetch it from. And I have to use the current state to build/pack them up for testing, that's why I'm overriding the MSBuildSDKsPath env variable!

@Nirmal4G
Copy link

Nirmal4G commented Apr 22, 2018

Oh, and while it's not implemented yet, tintoy/msbuild-project-tools-vscode#35 (comment) will make it a lot easier to override the extensions directory.

I like that feature. But could we make it generic by having any of the properties and env variables to override?

@tintoy
Copy link
Owner Author

tintoy commented Apr 22, 2018

Correct :)

@tintoy
Copy link
Owner Author

tintoy commented Apr 22, 2018

What about the steps to cause the error? Eg. Open file xxx, go to line a, column button, and hover the mouse pointer over it / type "<foo"...

@tintoy
Copy link
Owner Author

tintoy commented Apr 22, 2018

Column b, that is. Not column button (sorry, autocorrect).

@Nirmal4G
Copy link

Nirmal4G commented Apr 22, 2018

What about the steps to cause the error? Eg. Open file xxx, go to line a, column b, and hover the mouse pointer over it / type "<foo"...

Sorry about that, I thought something else!
Open my custom SDK based project like *.nuproj and/or *.csproj in TestProjects directory.
Do a hover or ctrl+tab completion on root project element (put the curser in the middle of the Project word and ctrl+tab) You'll see the same error in the log.

(sorry, autocorrect)

FYI You can edit comments on GitHub

If you can't get it, I'll post a GIF tomorrow!
Also it's past my curfew, so Good Night from here!

@tintoy
Copy link
Owner Author

tintoy commented Apr 22, 2018

Yeah, I'm on my phone and the mobile UI doesn't support editing comments unfortunately :)

I'll give it a try shortly and let you know what I find tomorrow!

@tintoy
Copy link
Owner Author

tintoy commented Apr 22, 2018

Ah! Ok, I see the problem; the root element has no parent (of course), so that completion provider has issues; I'll fix that shortly.

tintoy added a commit that referenced this issue Apr 22, 2018
tintoy added a commit to tintoy/msbuild-project-tools-vscode that referenced this issue Apr 22, 2018
@tintoy
Copy link
Owner Author

tintoy commented Apr 22, 2018

Ok - I've published a new release (v0.2.36) where that should be fixed (you can download and install the VSIX package manually for now; I haven't published it to the VS Marketplace yet.

@Nirmal4G
Copy link

Nirmal4G commented Apr 23, 2018

Trying it out!
It's working, No crashing.
But Hover won't work inside those projects

The Current Log:

Starting MSBuild language service...
MSBuild language service is running.
[Info  - 12:38:54] Successfully loaded project "N:\MSBuild-Sdks\Source\NuGet.Packaging.Sdk\NuGet.Packaging.Sdk.nuproj".
[Error - 12:43:43] Error loading MSBuild project '"N:\MSBuild-Sdks\Source\NuGet.Packaging.Sdk\Sdk\Sdk.Pack.targets"'.
System.InvalidOperationException: Parent project does not have an MSBuild project.
   at bool MSBuildProjectTools.LanguageServer.Documents.SubProjectDocument.TryLoadMSBuildProject() in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Documents\SubProjectDocument.cs:line 85
[Info  - 12:43:43] Successfully loaded project "N:\MSBuild-Sdks\Source\NuGet.Packaging.Sdk\Sdk\Sdk.Pack.targets" as a sub-project of "NuGet.Packaging.Sdk.nuproj".
[Info  - 12:50:48] Unloaded project "N:\MSBuild-Sdks\Source\NuGet.Packaging.Sdk\Sdk\Sdk.Pack.targets".
[Error - 12:50:48] Error loading MSBuild project '"N:\MSBuild-Sdks\Source\MSBuild.NET.Extras.Sdk\Build\MSBuild.NET.Extras.Items.props"'.
System.InvalidOperationException: Parent project does not have an MSBuild project.
   at bool MSBuildProjectTools.LanguageServer.Documents.SubProjectDocument.TryLoadMSBuildProject() in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Documents\SubProjectDocument.cs:line 85
[Info  - 12:50:48] Successfully loaded project "N:\MSBuild-Sdks\Source\MSBuild.NET.Extras.Sdk\Build\MSBuild.NET.Extras.Items.props" as a sub-project of "NuGet.Packaging.Sdk.nuproj".
[Error - 12:52:44] Error loading MSBuild project '"N:\MSBuild-Sdks\Source\MSBuild.NET.Extras.Sdk\Build\MSBuild.NET.Extras.Items.props"'.
System.InvalidOperationException: Parent project does not have an MSBuild project.
   at bool MSBuildProjectTools.LanguageServer.Documents.SubProjectDocument.TryLoadMSBuildProject() in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Documents\SubProjectDocument.cs:line 85
[Error - 12:52:45] Error loading MSBuild project '"N:\MSBuild-Sdks\Source\MSBuild.NET.Extras.Sdk\Build\MSBuild.NET.Extras.Items.props"'.
System.InvalidOperationException: Parent project does not have an MSBuild project.
   at bool MSBuildProjectTools.LanguageServer.Documents.SubProjectDocument.TryLoadMSBuildProject() in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Documents\SubProjectDocument.cs:line 85
[Error - 12:52:46] Error loading MSBuild project '"N:\MSBuild-Sdks\Source\MSBuild.NET.Extras.Sdk\Build\MSBuild.NET.Extras.Items.props"'.
System.InvalidOperationException: Parent project does not have an MSBuild project.
   at bool MSBuildProjectTools.LanguageServer.Documents.SubProjectDocument.TryLoadMSBuildProject() in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Documents\SubProjectDocument.cs:line 85
[Error - 12:52:47] Error loading MSBuild project '"N:\MSBuild-Sdks\Source\MSBuild.NET.Extras.Sdk\Build\MSBuild.NET.Extras.Items.props"'.
System.InvalidOperationException: Parent project does not have an MSBuild project.
   at bool MSBuildProjectTools.LanguageServer.Documents.SubProjectDocument.TryLoadMSBuildProject() in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Documents\SubProjectDocument.cs:line 85
[Error - 12:52:54] Error loading MSBuild project '"N:\MSBuild-Sdks\Source\MSBuild.NET.Extras.Sdk\Build\MSBuild.NET.Extras.Items.props"'.
System.InvalidOperationException: Parent project does not have an MSBuild project.
   at bool MSBuildProjectTools.LanguageServer.Documents.SubProjectDocument.TryLoadMSBuildProject() in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Documents\SubProjectDocument.cs:line 85
[Error - 12:52:55] Error loading MSBuild project '"N:\MSBuild-Sdks\Source\MSBuild.NET.Extras.Sdk\Build\MSBuild.NET.Extras.Items.props"'.
System.InvalidOperationException: Parent project does not have an MSBuild project.
   at bool MSBuildProjectTools.LanguageServer.Documents.SubProjectDocument.TryLoadMSBuildProject() in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Documents\SubProjectDocument.cs:line 85

@tintoy
Copy link
Owner Author

tintoy commented Apr 24, 2018

Hmm, that's interesting; it says it successfully loaded the first project (which is the "parent" referred to in the following errors), but subsequent project loads fail because they can't be matched up to the parent project (because although its XML could be parsed, the MSBuild engine failed to correctly load that XML).

Can you try closing all projects and then opening one of the projects that fails? Does that work for you?

@tintoy
Copy link
Owner Author

tintoy commented Apr 24, 2018

Ok, I turned on verbose logging, and MSBuild can't load the .nuproj:

Failed to load MSBuild proiect '"d:\Development\github\nirin\msbuild-sdks\Source\NuGet.Packaging.Sdk\NuGet.Packaging.Sdk.nuproj"' because the project file is invalid. "The SDK 'NuGet.Packaging.Sdk' specified could not be found.  d:\Development\github\nirin\msbuild-sdks\Source\NuGet.Packaging.Sdk\NuGet.Packaging.Sdk.nuproj"
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'NuGet.Packaging.Sdk' specified could not be found.  d:\Development\github\nirin\msbuild-sdks\Source\NuGet.Packaging.Sdk\NuGet.Packaging.Sdk.nuproj
   at void Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(string errorSubCategoryResourceName, IElementLocation elementLocation, string resourceName, object[] args) in E:\A\_work\17\s\src\Shared\ProjectErrorUtilities.cs:line 440
   at void Microsoft.Build.Evaluation.Evaluator<P, I, M, D>.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(string directoryOfImportingFile, ProjectImportElement importElement, out List<ProjectRootElement> projects, bool throwOnFileNotExistsError) in E:\A\_work\17\s\src\Build\Evaluation\Evaluator.cs:line 2412
   at List<ProjectRootElement> Microsoft.Build.Evaluation.Evaluator<P, I, M, D>.ExpandAndLoadImports(string directoryOfImportingFile, ProjectImportElement importElement) in E:\A\_work\17\s\src\Build\Evaluation\Evaluator.cs:line 2215
   at void Microsoft.Build.Evaluation.Evaluator<P, I, M, D>.EvaluateImportElement(string directoryOfImportingFile, ProjectImportElement importElement) in E:\A\_work\17\s\src\Build\Evaluation\Evaluator.cs:line 2070
   at void Microsoft.Build.Evaluation.Evaluator<P, I, M, D>.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport) in E:\A\_work\17\s\src\Build\Evaluation\Evaluator.cs:line 1006
   at IDictionary<string, object> Microsoft.Build.Evaluation.Evaluator<P, I, M, D>.Evaluate(ILoggingService loggingService, BuildEventContext buildEventContext) in E:\A\_work\17\s\src\Build\Evaluation\Evaluator.cs:line 794
   at void Microsoft.Build.Evaluation.Project.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings) in E:\A\_work\17\s\src\Build\Definition\Project.cs:line 2641
   at void Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings) in E:\A\_work\17\s\src\Build\Definition\Project.cs:line 2634
   at void Microsoft.Build.Evaluation.Project.Initialize(IDictionary<string, string> globalProperties, string toolsVersion, string subToolsetVersion, ProjectLoadSettings loadSettings) in E:\A\_work\17\s\src\Build\Definition\Project.cs:line 2711
   at new Microsoft.Build.Evaluation.Project(string projectFile, IDictionary<string, string> globalProperties, string toolsVersion, string subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings) in E:\A\_work\17\s\src\Build\Definition\Project.cs:line 512
   at Project Microsoft.Build.Evaluation.ProjectCollection.LoadProject(string fileName, IDictionary<string, string> globalProperties, string toolsVersion) in E:\A\_work\17\s\src\Build\Definition\ProjectCollection.cs:line 1122
   at bool MSBuildProjectTools.LanguageServer.Documents.MasterProjectDocument.TryLoadMSBuildProject() in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Documents\MasterProjectDocument.cs:line 168

Looks like MSBuild is failing to resolve the custom SDK (so the project won't load).

BTW, here's how you turn on verbose logging:

image

@tintoy
Copy link
Owner Author

tintoy commented Apr 24, 2018

(you only need to specify logging level, you can leave any other settings at their default values)

@tintoy
Copy link
Owner Author

tintoy commented Apr 24, 2018

Ok - the language service wasn't respecting any existing value for the MSBuildSdksPath environment variable. I'll put out a new release shortly that supports this.

@tintoy
Copy link
Owner Author

tintoy commented Apr 24, 2018

I've tested this in v0.2.37 and your project loads correctly, now.

@tintoy
Copy link
Owner Author

tintoy commented Apr 24, 2018

Later, this hot-fix will be replaced by the functionality from #6.

@Nirmal4G
Copy link

Nirmal4G commented Apr 24, 2018

Thanks, I'll follow it up.

Update:
YAY! It is ALIVE!!! So far no issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants