public OmniSharpCodeActionHandler(
     Mef.IRequestHandler <GetCodeActionsRequest, GetCodeActionsResponse> getActionsHandler,
     Mef.IRequestHandler <RunCodeActionRequest, RunCodeActionResponse> runActionHandler,
     DocumentSelector documentSelector,
     ISerializer serializer,
     ILanguageServer server,
     DocumentVersions documentVersions)
     : base(new CodeActionRegistrationOptions()
 {
     DocumentSelector = documentSelector,
     CodeActionKinds  = new Container <CodeActionKind>(
         CodeActionKind.SourceOrganizeImports,
         CodeActionKind.Refactor,
         CodeActionKind.RefactorExtract),
 })
 {
     _getActionsHandler = getActionsHandler;
     _runActionHandler  = runActionHandler;
     _serializer        = serializer;
     _server            = server;
     _documentVersions  = documentVersions;
     _executeCommandRegistrationOptions = new ExecuteCommandRegistrationOptions()
     {
         Commands = new Container <string>("omnisharp/executeCodeAction"),
     };
 }
 public static IEnumerable <IJsonRpcHandler> Enumerate(
     RequestHandlers handlers,
     ISerializer serializer,
     ILanguageServer mediator,
     DocumentVersions versions)
 {
     foreach (var(selector, getActionsHandler, runActionHandler) in handlers
              .OfType <Mef.IRequestHandler <GetCodeActionsRequest, GetCodeActionsResponse>,
                       Mef.IRequestHandler <RunCodeActionRequest, RunCodeActionResponse> >())
     {
         yield return(new OmniSharpCodeActionHandler(getActionsHandler, runActionHandler, selector, serializer, mediator, versions));
     }
 }
示例#3
0
 public static IEnumerable <IJsonRpcHandler> Enumerate(
     RequestHandlers handlers,
     OmniSharpWorkspace workspace,
     DocumentVersions documentVersions)
 {
     foreach (var(selector, openHandler, closeHandler, bufferHandler) in handlers
              .OfType <
                  Mef.IRequestHandler <FileOpenRequest, FileOpenResponse>,
                  Mef.IRequestHandler <FileCloseRequest, FileCloseResponse>,
                  Mef.IRequestHandler <UpdateBufferRequest, object> >())
     {
         var documentSyncKind = TextDocumentSyncKind.Incremental;
         //if (selector.ToString().IndexOf(".cake") > -1) documentSyncKind = TextDocumentSyncKind.Full;
         yield return(new OmniSharpTextDocumentSyncHandler(openHandler, closeHandler, bufferHandler, selector, documentSyncKind, workspace, documentVersions));
     }
 }
示例#4
0
 public OmniSharpTextDocumentSyncHandler(
     Mef.IRequestHandler <FileOpenRequest, FileOpenResponse> openHandler,
     Mef.IRequestHandler <FileCloseRequest, FileCloseResponse> closeHandler,
     Mef.IRequestHandler <UpdateBufferRequest, object> bufferHandler,
     DocumentSelector documentSelector,
     TextDocumentSyncKind documentSyncKind,
     OmniSharpWorkspace workspace,
     DocumentVersions documentVersions)
 {
     _openHandler      = openHandler;
     _closeHandler     = closeHandler;
     _bufferHandler    = bufferHandler;
     _documentSelector = documentSelector;
     _documentSyncKind = documentSyncKind;
     _workspace        = workspace;
     _documentVersions = documentVersions;
 }
示例#5
0
 public OmniSharpCodeActionHandler(
     Mef.IRequestHandler<GetCodeActionsRequest, GetCodeActionsResponse> getActionsHandler,
     Mef.IRequestHandler<RunCodeActionRequest, RunCodeActionResponse> runActionHandler,
     DocumentSelector documentSelector,
     ISerializer serializer,
     ILanguageServer server,
     DocumentVersions documentVersions)
 {
     _getActionsHandler = getActionsHandler;
     _runActionHandler = runActionHandler;
     _documentSelector = documentSelector;
     _serializer = serializer;
     _server = server;
     _documentVersions = documentVersions;
     _executeCommandRegistrationOptions = new ExecuteCommandRegistrationOptions()
     {
         Commands = new Container<string>("omnisharp/executeCodeAction"),
     };
 }
示例#6
0
 public OmniSharpTextDocumentSyncHandler(
     Mef.IRequestHandler <FileOpenRequest, FileOpenResponse> openHandler,
     Mef.IRequestHandler <FileCloseRequest, FileCloseResponse> closeHandler,
     Mef.IRequestHandler <UpdateBufferRequest, object> bufferHandler,
     DocumentSelector documentSelector,
     TextDocumentSyncKind documentSyncKind,
     OmniSharpWorkspace workspace,
     DocumentVersions documentVersions)
     : base(documentSyncKind, new TextDocumentSaveRegistrationOptions()
 {
     DocumentSelector = documentSelector,
     IncludeText      = true,
 })
 {
     _openHandler      = openHandler;
     _closeHandler     = closeHandler;
     _bufferHandler    = bufferHandler;
     _workspace        = workspace;
     _documentVersions = documentVersions;
 }