--- lang: ja-jp breaks: true --- # `VSIX` による、エディタの操作 `IEditorOperationsFactoryService` 2022-01-26 ## `IEditorOperationsFactoryService` をインポートする定義を記述 ```csharp= [Import] internal IEditorOperationsFactoryService EditorOperations = null; ``` ## `IWpfTextView` から `IEditorOperations` を取得 ```csharp= public IEditorOperations GetEditorOperations(IWpfTextView textView) { if (EditorOperations != null && textView != null) { return EditorOperations.GetEditorOperations(textView); } return null; } ``` ## `IEditorOperations` を使ってエディタの操作を記述 ```csharp= if (EditorOperations != null) { bool extendSelection = false; if (textView.Selection.IsEmpty == false) { extendSelection = true; } // カーソルを一行下に移動 EditorOperations.MoveLineDown(extendSelection: extendSelection); } ``` ###### tags: `VSIX` `IEditorOperationsFactoryService` `IEditorOperations` `IWpfTextView`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up