-
Notifications
You must be signed in to change notification settings - Fork 6
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
Support Visual Studio #28
Comments
Initial poc tests with https://learn.microsoft.com/en-us/visualstudio/extensibility/adding-an-lsp-extension?view=vs-2022 suggest that the default LSP client may not be ideal: From that page, May need to investigate using the OmniSharp language client and explicitly wiring up default handles, (e.g. see QuickInfo tooltip - https://learn.microsoft.com/en-us/visualstudio/extensibility/walkthrough-displaying-quickinfo-tooltips?view=vs-2022&tabs=csharp) into the language client call to the language server. |
It would be great to have Visual Studio 2022 support. This is a great adjunct to our documentation; however, we extensively use NCrunch which is only available in Visual Studio. Is there any help we could provide? |
@jimdeane, thanks for your interest! I have recently had some confirmation from the folk at MS that the recommended extensibility approach is here: https://learn.microsoft.com/en-us/visualstudio/extensibility/visualstudio.extensibility/language-server-provider/language-server-provider?view=vs-2022 I was planning on starting on it in a few weeks, in June 2024. If you are keen to assist, feel free to take a look at that link and try and get it started. The existing language server is available as a separate binary download from github releases, so you could start by downloading that and configuring a hardcoded path just to test out the language server integration, and then once that's working we can look at integrating it into the CI build so that the windows binary gets embedded in the built/published extension. If you don't get a chance, no worries, I hope to update this ticket in June with progress. Cheers! |
Gave this a shot today. Result for now was that something is happening (the language server .exe shows some CPU utilization when hovering over a word and some logs show messages exchanged with the language server). However, no visual result is visible in Visual Studio. Not sure when or how I will continue with this, but definitely interested in seeing Contextive become available for VS. |
Thanks for getting the ball rolling on this! If you're able to share the logs that show messages exchanged, I'll see if I can help interpret what's happening. Either way, even if you're not able to continue with this, I appreciate you making this effort, it will definitely help me make progress! |
Here is the log: VS156025C6.LSPClient.Microsoft.VisualStudio.LanguageServer.Client.VSExtensibilityLanguageServerProviderClient.JCRC.zip Sorry about the German in the exception message. After System.AggregateException it says that at least one error occured. And after System.ArgumentNullException, it says that the value may not be NULL. |
Thanks for sharing this! Looking through the raw xml logs, there are two errors:
I think next steps might be for me to prep a version on a branch that:
And then see if that gets us anywhere - if you have time to assist that would be helpful and I'll let you know when the test version of the languageserver is ready, but if not, totally understand! |
Hi @FH-Inway -you should be able to download a zip containing a special build of the language server from here: https://github.com/dev-cycles/contextive/actions/runs/10017860097/artifacts/1721452354 It has detailed file logging (including json of protocol messages) to a date-rotating file in the same folder as the language server exe file itself. Also, it no longer sends the If you could give it a try with your visual studio extension and upload the logfiles that would be great! (Apologies, I don't have easy access to a windows box to try myself just at the moment). |
Thanks, that was helpful. The good news, progress! My branch shows the changes I made to get there. Some I took from your branch. To get the result from the screenshot, I had to hardcode the full path to the definitions.yml file in the PathResolver.fs. What I think is happening is that when it cannot determine the definitions.yml file, it has no content for the See also the Contextive.LanguageServer log20240720-Analysis6.zip from the run where I created the screenshot and compare it with log20240720-Analysis5.zip, where I had not changed the Here is also the Visual Studio log file from the successful run: It looks to me like we have to teach the Visual Studio extension to provide the workspace/folder/file path context information to the language server so it can determine the definitions.yml. And if it cannot, some kind of error message to the user. Some other notes (and a bit of a rant 😄 )I had a hell of a time to get this running. First, I tried the Contextive.LanguageServer.exe from your build. Unfortunately, it did not create a log file. Not sure why, I ended up providing a fixed file path for the log file.
So yeah, a bit of a learning curve for me there. I'm sure someone more familiar with F# and Visual Studio extension finds this amusing. Oh well, live and learn, I guess 😃 |
Wow, thanks so much, amazing work - so great to see the screenshot (although it would be nice if VS supported markdown 🤦)! And apologies for the frustrations (will address some below)! Based on your experience, I have a few hypotheses - both the symptoms you saw - the absence of the logfile and being unable to find the definitions file - are due to lack of clarity of the 'current working directory', but different directories. LogfileThe language server I sent you used a relative path to the logfile, so it would be located in the working folder at the time of invoking the language server. I assumed it would be next to the exe file because I misread the invocation code as setting the working folder, but actually it's setting the full path of the filename. So it's using the default working directory of I suspect if you set the WorkingDirectory explicitly (maybe to the solution folder location?), then the original LanguageServer I sent you would put the logfiles in that location. Since the release build doesn't log to file normally, I'm not too worried about this, but good to note for future dev work against Visual Studio. Definitions FileThe language server defaults to a relative location from the 'workspace root', however based on the error message The workspace root is supposed to be defined in the 👉 ACTION: To help diagnose this, could you uncomment line 14 in Program.fs which will enable full logging of the protocol messages, and will tell us what Visual Studio is sending down with respect to workspaces or root paths. For IDEs that don't supply a workspace root, Contextive requires the path to be configured explicitly, but since the There has been some discussion about changing the configuration approach to make it editor agnostic and remove dependency on the Warning Message
While I get the hypothesis, I'm not sure this is the cause - if it can't find the file, then the So this one is still a mystery, but given the low maturity of the visual studio LSP support, my feeling is probably a bug on that side, but happy to keep investigating as we do still need some way to signal issues to users. Other Note / Rant ThoughtsFirstly, apologies for the hassle you had with this! As you can tell, this is a relatively early project, which has had limited community support so far, so I haven't invested heavily in supporting a variety of dev environments. The DevContainer should create a useful build environment, but as it's a linux container, building the windows binary is more painful (but not impossible) so I can understand why you didn't use it. I've also been experimenting with nix-shell, which might be a better cross-platform experience and enabling more IDEs (I use it for Rider, but it should make life easier for Visual Studio too). This is a good prompt to both:
Regarding the .net sdk version issues - I doubt it's related, but for clarity, since you branched, I completed some work to bump contextive to .net8 which is now on the |
Thanks for the extensive info. First of all, no worries about my frustrations, isn't that a developers daily business? 😉 Ok, let me go through it point by point: LogfileUnfortunately, I did not find any log files in Definitions fileHere is a log with JSON formatting: log20240721-Analysis7.zip Viewing those is a bit awkward, since it is a JSON within a JSON within a JSON 😄 Anyways, looks to me like the I did read a bit through the discussion on editor agnostic config files. Not sure I understand all aspects, to me, it looks like the language server would still need to know the root path of where to look for a config file. Warning messageSince a successful run has no Other notesAgain, don't worry about my rant/hassle, it's the good kind (as in "I'm motivated to learn how this works") 😉
|
OK, great - now that we know it does supply the But I've added support for it here including unit tests. I think the next thing that would be interesting to try is:
While it does skip the If this works, then we'll try re-introducing showMessage and check that the exception there doesn't interrupt usage. If that works, then it would be great to do a more comprehensive user experience check, specifically things like:
Then can make an assessment on if/when to launch to the VS marketplace :) Thanks again, really appreciate your help with this! |
Thanks! Regarding the more comprehensive user experience check:
|
Amazing progress, thank you! I think at this point I'd be happy to put it on the marketplace with appropriate caveats, and then take it back to the MS team I'm in touch with to advocate for the necessary improvements on their end (support in solution mode, and markdown support). Looking at the branch comparison, apart from the forced logging (and logfile name change) and some formatting changes, the language server is the same as the one in my branch. I'll revert the forced logging and merge it to main with just the functional changes (support for clients that don't offer workspaces & avoiding errors in clients that don't offer showMessage). I use conventional commits to generate release logs, so I'd like to merge those independently to get them in the release notes. So in preparation for creating a clean PR and merging it, could you please revert all those language server changes and create a PR that just includes the new That last change we'll need to look at in prep for getting it into CI is clarity on embedding the language server into the solution so that it gets included in the |
OK, those two changes are now in |
I rebased again on main and created a new branch visual-studio (not to be confused with your visual-studio branch), which I cleaned up. It now only has one conventional commit, which only contains the extension changes and no changes on the language server. The extension from that branch works with the latest main language server, but... 😄 I also tried embedding the language server into the extension solution by adding a reference to the language server project. Building works, all the language server stuff is added to the vsix. Well, almost all. When running it, I get a message that the JSON-RPC connection was lost. Why? Windows event log tells me that it could not load Newtonsoft.Json, version 13.0.0.0 (note the version number). My preliminary digging into this revealed that it may be related to Visual Studio having its own Newtonsoft.Json dlls and it wants to use those. See https://stackoverflow.com/questions/50003033/vsix-newtonsoft-isnt-in-package-vs15-5-suppress-package and JamesNK/Newtonsoft.Json#2534 If I redirect the extension to use the Contextive.LanguageServer.exe from the build directory (which has the 13.0.3 Newstonsoft.Json.dll) instead of the extension directory, it works. This needs further looking into, I don't think we should release it without fixing it. Maybe something can be done with the extension manifest to include the .dll. While I understand that is not recommended, I believe this only applies for the Visual Studio extension itself. But since the language server is a separate component, it should be fine to use its own dll instead of the ones Visual Studio ships with. Popup message in Visual Studio: Windows event message:
|
On another note, I don't think the extension will be useful if it cannot support files opened from a solution. Solutions are the main working context in Visual Studio, unlike Visual Studio Code, where you often work within a folder context. A lot of functionality is lost in Visual Studio if no solution, but a folder is opened. I can't imagine it will get much adoption with that limitation. On another another note 😄, the extension is currently implemented in C#. I'd like to give it a go to implement it in F# and also add some tests to it similar to what was done for the Visual Studio Code extension. |
Thanks again, @FH-Inway! VS Solution vs Folder modeYou are 100% correct that it's far less useful if it only works in folder mode. My motivation in launching it to the app store even in this state is twofold:
I believe their justification is that the LSP is intended for unsupported languages -> unsupported languages wouldn't need solution mode -> no need to support it. However, as well as Contextive's use case, I think there are a number of polyglot solutions these days that would benefit from supporting additional language servers alongside the built-in language support offered in solution mode, and I hope I can make that case. Build ProcessYes, apologies I should have made it clear - it was always my intention to re-use the pre-built language server and embed it as a resource in the extension, rather than have it re-built as a project reference in the extension solution. This is now the recommended LSP architecture, and it takes care of many issues - the ones you found (such as dependency conflict) but also frees us up to evolve our sdk version usage at different times, and ensures it's using an isolated, tested, immutable artefact for the language server component. The github actions currently have a stage that prepare the language server and make it available as an artefact. Successive stages can download that artefact to the appropriate location before running a script to build the vsix that will have it embedded. I can take care of updating the github actions once the other parts are in place. FSharpI see you also like playing on hard mode 😎 - by all means, go for it, but also, I don't mind releasing an alpha version with what we have and migrating to FSharp later - totally up to you if you want to enjoy the challenge :) |
I am a lone VS Code user in an organization that primarily uses Visual Studio. I would love to introduce this tool into our code base, but lack of VS support is a blocker. Just wanted to chime in and let you know VS support is highly desirable! |
@chrissimon-au Fair enough. I removed the changes on the main solution and also removed the language server project dependency from the Visual Studio extension project. See pr #70 @NatElkins Thanks for letting us know and the interest. Would you be interested in helping us test this Visual Studio integration? |
Sadly I'm on a Mac 😅 . But if I can get my hands on a Parallels installation through work I'll take a crack at it. |
Hi, I've been hanging around in the background watching this unfold and I'm very happy to beta test, along with one or two members of our team 😄
Along the way we've been experimenting (only hacked together PoCs) with a Word (Office 365 really...) add-in and a browser (Edge) extension to provide the same function. Not sure we have the time to build out both though. Also, we are likely to want to pull from the SNOMED medical terms database for our development use case which will probably be outside of the useful capabilities of YAML as the terms run into the many thousands.
Let me know if we can help beta test. I'll speak to the team about the Word / Edge add-in and see if we can take these further.
Jim Deane
…________________________________
From: Nat Elkins ***@***.***>
Sent: Thursday, July 25, 2024 3:06 am
To: dev-cycles/contextive ***@***.***>
Cc: Jim Deane ***@***.***>; Mention ***@***.***>
Subject: Re: [dev-cycles/contextive] Support Visual Studio (Issue #28)
Sadly I'm on a Mac 😅 . But if I can get my hands on a Parallels installation through work I'll take a crack at it.
—
Reply to this email directly, view it on GitHub<#28 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAOVKMNLUC5IZQFYYT7IF63ZOBFPJAVCNFSM5NIHQVSKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMRUHEYTKMBZGIYQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Thanks to testing volunteers! To be clear about limitations in the current version - it should be treated as an 'alpha' version only, for a few reasons:
The goal of releasing this alpha version is as a proof of concept and to demonstrate interest in these features to the MS team to advocate for improving support. Stay tuned, we should have a vsix produced on the CI pipeline in the next 24-48 hrs that will be testable locally, and shortly after that a version installable from the VS extension marketplace. Huge thanks to @FH-Inway for this work!! 😍 |
Both of these have been on my longer term roadmap - knowing that there may be an application for them is definitely motivating! If you're able to open source the POCs you've done it might help accelerate, but stay tuned for work that will expand Contextive beyond the IDE into those locations. Given the technical architecture of such things, it will likely require the establishment of a cloud service to host the terminology database - which might actually enable the volume of terms you're talking about with SNOMED. (It will also support making the slackbot I've demo'd in a few talks more broadly available too.). It's an open question how to get the benefits of having term definitions co-located and versions in the repo while getting the benefits of making the terms available in a broader set of user contexts. I'll leave that discussion to another issue, though! |
I think this extension/application has a lot of potential to improve code base understanding in an LLM world. |
Alright, this has been fun. @chrissimon-au Thanks for the merge and the nice back and forth these last two weeks. Looking forward to seeing the alpha version of the extension on the marketplace. @jimdeane Those PoCs for Office and browser sound very intruiging, would be great if you could share more about them. But yeah, let's do that in another issue or discussion. This one has gotten rather long 😄 |
Looking forward to testing!
Re the Office / Browser extension PoCs, can we start another thread for that now??
Jim Deane
…________________________________
From: Florian Hopfner ***@***.***>
Sent: Thursday, July 25, 2024 4:29 PM
To: dev-cycles/contextive ***@***.***>
Cc: Jim Deane ***@***.***>; Mention ***@***.***>
Subject: Re: [dev-cycles/contextive] Support Visual Studio (Issue #28)
Alright, this has been fun. @chrissimon-au<https://github.com/chrissimon-au> Thanks for the merge and the nice back and forth these last two weeks. Looking forward to seeing the alpha version of the extension on the marketplace.
@jimdeane<https://github.com/jimdeane> Those PoCs for Office and browser sound very intruiging, would be great if you could share more about them. But yeah, let's do that in another issue or discussion. This one has gotten rather long 😄
—
Reply to this email directly, view it on GitHub<#28 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAOVKMPEIRDG5QWWUEB24ILZOEKVFAVCNFSM5NIHQVSKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMRVGA3DQNJVGI3A>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
New thread created here: #71 |
OK, for those interested in alpha testing, there is a vsix downloadable here produced by this github actions run (you can also download it from the list of artifacts on the run). The downloaded file will be a zip - unzip it to get the vsix and then install by double clicking or using the Tools->Extension Manger in Visual Studio. Unfortunately I don't have access to a windows box right now, so I'm not able to check that the vsix even installs correctly, but from visual inspection of its contents, it looks like it should be correct. Appreciate your assistance! To test:
I'm not sure if we've tested Visual Studio's ability to notify contextive of changes to the definitions file, so if it doesn't work first time, try re-opening the folder with the definitions file already in place. For @FH-Inway - the language server is embedded in the vsix file - right beside the extension's dll - so it should find and start it properly, but if anything doesn't work, incorrect path to the language server exe is probably the first thing I'd try and check. |
Works for me. Though I noticed a couple of things:
|
Although it's the older extensibility model, the only MS documentation on which LSP features are supported is here: If that is still accurate in the new extensibility model, then Since both have not worked for us, perhaps we should assume that the support is not the same. I'll see if I can get any further clarity on which LSP features are supported in the new extensibility model. |
A few more updates after further investigation: Leftover
|
Have had a reply from MS. Their preferred reporting approach is here: https://developercommunity.visualstudio.com/VisualStudio?q=lsp I've also found https://github.com/microsoft/VSExtensibility which might have some helpful info in the future. My plan now is to report each issue we find on the community site and cross-link it to a specific contextive issue so we can track them independently and get this current ticket closed off once it's launched to the marketplace. To summarise issues I'll be reporting:
Note that the MS VS team prioritises work based on community votes on that developer community portal. If having Contextive in Visual Studio is important to you, please upvote the suggestions/bugs which should be linked to on each of the github issues above. |
# [1.12.0](v1.11.1...v1.12.0) (2024-09-04) ### Bug Fixes * **intellij:** Add support for 2042.2 series of intellij platform ([08308bf](08308bf)) ### Features * **language-server:** Add support for LSP Clients that only support rootUri and not workspaces (e.g. Visual Studio) ([7fe11b3](7fe11b3)) * **language-server:** Add yaml schema for definitions file ([#74](#74)) ([65ec44a](65ec44a)) * **language-server:** Only use 'window/showMessage' if it is supported by the LanguageClient (e.g. Visual Studio does not support it) ([965cb30](965cb30)) * **language-server:** validate definitions file for missing term names ([0fb0978](0fb0978)) * **visual-studio:** Add Visual Studio integration ([b052a82](b052a82)), closes [#28](#28)
# [1.12.0](v1.11.1...v1.12.0) (2024-09-04) ### Bug Fixes * **intellij:** Add support for 2042.2 series of intellij platform ([08308bf](08308bf)) ### Features * **language-server:** Add support for LSP Clients that only support rootUri and not workspaces (e.g. Visual Studio) ([7fe11b3](7fe11b3)) * **language-server:** Add yaml schema for definitions file ([#74](#74)) ([65ec44a](65ec44a)) * **language-server:** Only use 'window/showMessage' if it is supported by the LanguageClient (e.g. Visual Studio does not support it) ([965cb30](965cb30)) * **language-server:** validate definitions file for missing term names ([0fb0978](0fb0978)) * **visual-studio:** Add Visual Studio integration ([b052a82](b052a82)), closes [#28](#28)
# [1.12.0](v1.11.1...v1.12.0) (2024-09-04) ### Bug Fixes * **intellij:** Add support for 2042.2 series of intellij platform ([08308bf](08308bf)) ### Features * **language-server:** Add support for LSP Clients that only support rootUri and not workspaces (e.g. Visual Studio) ([7fe11b3](7fe11b3)) * **language-server:** Add yaml schema for definitions file ([#74](#74)) ([65ec44a](65ec44a)) * **language-server:** Only use 'window/showMessage' if it is supported by the LanguageClient (e.g. Visual Studio does not support it) ([965cb30](965cb30)) * **language-server:** validate definitions file for missing term names ([0fb0978](0fb0978)) * **visual-studio:** Add Visual Studio integration ([b052a82](b052a82)), closes [#28](#28) * **vscode:** Publish to Open-Vsx Marketplace (closes [#80](#80)) ([2d23775](2d23775))
Released on v1.12.0 Now available on the VS Marketplace here: https://marketplace.visualstudio.com/items?itemName=devcycles.ContextiveVisualStudio Since publishing, I've realised that the VS extension publishing guidelines are missing some important steps, including nomination of which VS editions this is valid for. It's possible that this version will only work with Visual Studio Community edition. I'll look to mark it as supporting more editions in the next release. Also note that I'm aware that due to the many usability issues at the moment, I don't expect this will suit all cases, but now I have a CI pipeline for publishing and an extension in the marketplace, I hope this will be a baseline to improve on as VS improves their language server protocol support. |
Nice to see it out there! The ReadMe should also updated, it currently has the information for the VSCode extension. |
The readme was updated to be visual studio specific, except I missed the installation instructions link 🤦 Already sorted on main will get picked up in the next update. |
See https://docs.microsoft.com/en-us/visualstudio/extensibility/starting-to-develop-visual-studio-extensions?view=vs-2019
The text was updated successfully, but these errors were encountered: