public async Task <EditorContext> GetEditorContextAsync()
        {
            ClientEditorContext clientContext =
                await _languageServer.SendRequest <GetEditorContextRequest, ClientEditorContext>(
                    "editor/getEditorContext",
                    new GetEditorContextRequest());

            return(this.ConvertClientEditorContext(clientContext));
        }
        public async Task <ILspCurrentFileContext> GetCurrentLspFileContextAsync()
        {
            ClientEditorContext clientContext =
                await _languageServer.SendRequest <GetEditorContextRequest, ClientEditorContext>(
                    "editor/getEditorContext",
                    new GetEditorContextRequest()).ConfigureAwait(false);

            return(new LspCurrentFileContext(clientContext));
        }
        public async Task <EditorContext> GetEditorContext()
        {
            ClientEditorContext clientContext =
                await this.messageSender.SendRequest(
                    GetEditorContextRequest.Type,
                    new GetEditorContextRequest(),
                    true);

            return(this.ConvertClientEditorContext(clientContext));
        }
Beispiel #4
0
        public async Task <EditorContext> GetEditorContextAsync()
        {
            if (!TestHasLanguageServer())
            {
                return(null);
            }
            ;

            ClientEditorContext clientContext =
                await _languageServer.SendRequest <GetEditorContextRequest, ClientEditorContext>(
                    "editor/getEditorContext",
                    new GetEditorContextRequest()).ConfigureAwait(false);

            return(this.ConvertClientEditorContext(clientContext));
        }
 public EditorContext ConvertClientEditorContext(
     ClientEditorContext clientContext)
 {
     return
         (new EditorContext(
              this,
              this.editorSession.Workspace.GetFile(clientContext.CurrentFilePath),
              new BufferPosition(
                  clientContext.CursorPosition.Line + 1,
                  clientContext.CursorPosition.Character + 1),
              new BufferRange(
                  clientContext.SelectionRange.Start.Line + 1,
                  clientContext.SelectionRange.Start.Character + 1,
                  clientContext.SelectionRange.End.Line + 1,
                  clientContext.SelectionRange.End.Character + 1)));
 }
Beispiel #6
0
        public EditorContext ConvertClientEditorContext(
            ClientEditorContext clientContext)
        {
            ScriptFile scriptFile = _workspaceService.GetFileBuffer(
                clientContext.CurrentFilePath,
                clientContext.CurrentFileContent);

            return
                (new EditorContext(
                     this,
                     scriptFile,
                     new BufferPosition(
                         (int)clientContext.CursorPosition.Line + 1,
                         (int)clientContext.CursorPosition.Character + 1),
                     new BufferRange(
                         (int)clientContext.SelectionRange.Start.Line + 1,
                         (int)clientContext.SelectionRange.Start.Character + 1,
                         (int)clientContext.SelectionRange.End.Line + 1,
                         (int)clientContext.SelectionRange.End.Character + 1),
                     clientContext.CurrentFileLanguage));
        }
Beispiel #7
0
        public EditorContext ConvertClientEditorContext(
            ClientEditorContext clientContext)
        {
            ScriptFile scriptFile = this.editorSession.Workspace.CreateScriptFileFromFileBuffer(
                clientContext.CurrentFilePath,
                clientContext.CurrentFileContent);

            return
                (new EditorContext(
                     this,
                     scriptFile,
                     new BufferPosition(
                         clientContext.CursorPosition.Line + 1,
                         clientContext.CursorPosition.Character + 1),
                     new BufferRange(
                         clientContext.SelectionRange.Start.Line + 1,
                         clientContext.SelectionRange.Start.Character + 1,
                         clientContext.SelectionRange.End.Line + 1,
                         clientContext.SelectionRange.End.Character + 1),
                     clientContext.CurrentFileLanguage));
        }
Beispiel #8
0
 public LspCurrentFileContext(ClientEditorContext editorContext)
 {
     _editorContext = editorContext;
     Uri            = new Uri(editorContext.CurrentFilePath);
 }