public Task <Unit> Handle(DidOpenTextDocumentParams notification, CancellationToken token)
        {
            ScriptFile openedFile =
                _workspaceService.GetFileBuffer(
                    notification.TextDocument.Uri.ToString(),
                    notification.TextDocument.Text);

            // TODO: Get all recently edited files in the workspace
            _analysisService.RunScriptDiagnosticsAsync(new ScriptFile[] { openedFile });

            _logger.LogTrace("Finished opening document.");
            return(Unit.Task);
        }
예제 #2
0
        public Task <Unit> Handle(DidOpenTextDocumentParams notification, CancellationToken token)
        {
            ScriptFile openedFile =
                _workspaceService.GetFileBuffer(
                    notification.TextDocument.Uri,
                    notification.TextDocument.Text);

            // Kick off script diagnostics without blocking the response
            // TODO: Get all recently edited files in the workspace
            _analysisService.RunScriptDiagnostics(new ScriptFile[] { openedFile }, token);

            _logger.LogTrace("Finished opening document.");
            return(Unit.Task);
        }
        public override Task <Unit> Handle(DidOpenTextDocumentParams notification, CancellationToken token)
        {
            ScriptFile openedFile =
                _workspaceService.GetFileBuffer(
                    notification.TextDocument.Uri,
                    notification.TextDocument.Text);

            if (LspUtils.PowerShellDocumentSelector.IsMatch(new TextDocumentAttributes(
                                                                // We use a fake Uri because we only want to test the LanguageId here and not if the
                                                                // file ends in ps*1.
                                                                s_fakeUri,
                                                                notification.TextDocument.LanguageId)))
            {
                // Kick off script diagnostics if we got a PowerShell file without blocking the response
                // TODO: Get all recently edited files in the workspace
                _analysisService.RunScriptDiagnostics(new ScriptFile[] { openedFile });
            }

            _logger.LogTrace("Finished opening document.");
            return(Unit.Task);
        }
예제 #4
0
        public EditorContext ConvertClientEditorContext(
            ClientEditorContext clientContext)
        {
            ScriptFile scriptFile = _workspaceService.GetFileBuffer(
                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));
        }