如何将光标放置在使用VSIX可扩展性创建的“区域”中

问题描述 投票:0回答:1
eg: REGION
    | //Cursor should be here 
    END REGION

在创建Region时,应将光标点自动放置在创建的Region内,就像在普通的Visual Studio中一样,我正在使用Visual Studio 2017使用VSIX可扩展性

我尝试过

Console.SetCursorPosition(x, y); //but it is not working

请提供解决方案。在此先感谢

c# visual-studio console vsix vs-extensibility
1个回答
0
投票

要更改当前Visual Studio编辑器中的插入符位置,请使用以下代码:

EnvDTE.TextSelection ts = DTE.ActiveDocument?.Selection as EnvDTE.TextSelection;
ts?.MoveToLineAndOffset(line, column);
© www.soinside.com 2019 - 2024. All rights reserved.