tintoy / msbuild-project-tools-vscode

VS Code extension for MSBuild intellisense (including PackageReference completion).
MIT License
82 stars 16 forks source link

Support for custom file extensions #11

Closed apobekiaris closed 6 years ago

apobekiaris commented 6 years ago

Hi

My msbuild files have a .build extension and I would like to use this tool, is it possible to configure somehow ?

tintoy commented 6 years ago

Yes! There is a command called "change language for file extension" - just change the language to "MSBuild". It's Ctrl-K M from memory.

tintoy commented 6 years ago

Thanks, I'll add that to the README, it's not obvious.

apobekiaris commented 6 years ago

can you be a bit more specific I cannot locate this "change language for file extension" command. I tried to associate the .build with the msbuild language but I get

[Error - 11:15:18 PM] Unhandled exception in OnDidOpenTextDocument. System.ArgumentException: Unexpected project file extension '.build'. Parameter name: documentUri at MSBuildProjectTools.LanguageServer.Documents.ProjectDocument..ctor(Workspace workspace, Uri documentUri, ILogger logger) in D:\Development\github\tintoy\msbuild-project-tools\src\LanguageServer.Engine\Documents\ProjectDocument.cs:line 97 at MSBuildProjectTools.LanguageServer.Documents.MasterProjectDocument..ctor(Workspace workspace, Uri documentUri, ILogger logger) in D:\Development\github\tintoy\msbuild-project-tools\src\LanguageServer.Engine\Documents\MasterProjectDocument.cs:line 46 at MSBuildProjectTools.LanguageServer.Documents.Workspace.<>cDisplayClass20_0.b_0(Uri ) in D:\Development\github\tintoy\msbuild-project-tools\src\LanguageServer.Engine\Documents\Workspace.cs:line 135 at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) at MSBuildProjectTools.LanguageServer.Documents.Workspace.d20.MoveNext() in D:\Development\github\tintoy\msbuild-project-tools\src\LanguageServer.Engine\Documents\Workspace.cs:line 130 --- End of stack trace from previous location where exception was thrown ---

apobekiaris commented 6 years ago

found the command also but when i click on the MSBuild language i get the same exception i posted before. VsCode 1.16 x64

tintoy commented 6 years ago

Ouch! Sorry, that's a bug. I'll fix that right away - give me 10 mins or so.

tintoy commented 6 years ago

Ok - I've tested the fix and it looks like it works correctly now; would you mind updating the extension to v0.2.4 and letting me know if this fixes your problem?

BTW, the docs now show how to change file associations.

apobekiaris commented 6 years ago

much better now many thnks!

wow first time in years I will actually be able to write msbuild scripts so productive. I wish this tool were available 10 years ago :). Great work!