question

njsokalski avatar image
0 Votes"
njsokalski asked DylanZhu-MSFT commented

Visual Studio 2019 Extensions: Text Editor

I am very new to writing Extensions for Visual Studio 2019 (or any other version), but would like to learn. The Extension that I want to write will require knowing the following:

  • Viewing/editing a code file

  • Determining whether the current text is a comment (this could be done manually, but if possible, I would like VS to determine it for me)

  • Creating a Toolbar (and preferably saving their state, since they will basically be like Radio Buttons where only 1 is selected)

  • Detecting the pressing of the arrow keys

Most of the tutorials & other information I have been able to find explain how to do stuff with Commands & Menus and how the editor displays the text (color, underlining, outlining, etc.), but I have found almost nothing on responding to what happens while the Editor is being used. I am not sure where to start or find the necessary info. Can anybody tell me anywhere that focuses on editing the text rather than displaying it? Thanks.

vs-extensions
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @njsokalski ,

Is there any update about this thread? If you have other question about it, please feel free to contact us.

Best Regards,
Dylan

0 Votes 0 ·
SergeyVlasov avatar image
0 Votes"
SergeyVlasov answered

I recommend to read Inside the editor and Language service and editor extension points to familiarize yourself how the editor works and how it can be extended.


Sergey Vlasov | Visual Studio extensions and tools


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DylanZhu-MSFT avatar image
0 Votes"
DylanZhu-MSFT answered

Hi njsokalski,

Could Sergey's suggestion help you? I suggest you could refer to this sample: Editor With Toolbox Sample. Though the sample works with VS 2017, but the related SDK can still work in VS 2019.

In addition, about “Detecting the pressing of the arrow keys”, you could read Use a shortcut key with an editor extension, the key will work with the editor you want.

Best Regards,
Dylan


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.