Visual Studio 2019 Extensions: Text Editor

Nathan Sokalski 4,116 Reputation points
2020-08-17T21:33:07.563+00:00

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.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,928 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Sergey Vlasov 266 Reputation points
    2020-08-18T04:24:07.593+00:00

    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

    0 comments No comments

  2. Dylan Zhu-MSFT 6,406 Reputation points
    2020-08-24T04:26:33.817+00:00

    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

    0 comments No comments