|
3 | 3 | import * as path from 'path'; |
4 | 4 | import * as os from 'os'; |
5 | 5 | import * as fs from 'fs'; |
6 | | -import { workspace, extensions, ExtensionContext, window, StatusBarAlignment, commands, ViewColumn, Uri, CancellationToken, TextDocumentContentProvider, TextEditor, WorkspaceConfiguration, languages, IndentAction, ProgressLocation, InputBoxOptions, Selection, Position, EventEmitter } from 'vscode'; |
| 6 | +import { workspace, extensions, ExtensionContext, window, StatusBarAlignment, commands, ViewColumn, Uri, CancellationToken, TextDocumentContentProvider, TextEditor, WorkspaceConfiguration, languages, IndentAction, ProgressLocation, InputBoxOptions, Selection, Position, EventEmitter, OutputChannel } from 'vscode'; |
7 | 7 | import { ExecuteCommandParams, ExecuteCommandRequest, LanguageClient, LanguageClientOptions, RevealOutputChannelOn, Position as LSPosition, Location as LSLocation, StreamInfo, VersionedTextDocumentIdentifier, ErrorHandler, Message, ErrorAction, CloseAction, InitializationFailedHandler } from 'vscode-languageclient'; |
8 | 8 | import { onExtensionChange, collectJavaExtensions } from './plugin'; |
9 | 9 | import { prepareExecutable, awaitServerConnection } from './javaServerStarter'; |
@@ -73,6 +73,42 @@ class ClientErrorHandler implements ErrorHandler { |
73 | 73 | } |
74 | 74 | } |
75 | 75 |
|
| 76 | +class OutputInfoCollector implements OutputChannel { |
| 77 | + private channel: OutputChannel = null; |
| 78 | + |
| 79 | + constructor(public name: string) { |
| 80 | + this.channel = window.createOutputChannel(this.name); |
| 81 | + } |
| 82 | + |
| 83 | + append(value: string): void { |
| 84 | + logger.info(value); |
| 85 | + this.channel.append(value); |
| 86 | + } |
| 87 | + |
| 88 | + appendLine(value: string): void { |
| 89 | + logger.info(value); |
| 90 | + this.channel.appendLine(value); |
| 91 | + } |
| 92 | + |
| 93 | + clear(): void { |
| 94 | + this.channel.clear(); |
| 95 | + } |
| 96 | + |
| 97 | + show(preserveFocus?: boolean): void; |
| 98 | + show(column?: ViewColumn, preserveFocus?: boolean): void; |
| 99 | + show(column?: any, preserveFocus?: any) { |
| 100 | + this.channel.show(column, preserveFocus); |
| 101 | + } |
| 102 | + |
| 103 | + hide(): void { |
| 104 | + this.channel.hide(); |
| 105 | + } |
| 106 | + |
| 107 | + dispose(): void { |
| 108 | + this.channel.dispose(); |
| 109 | + } |
| 110 | +} |
| 111 | + |
76 | 112 | export function activate(context: ExtensionContext): Promise<ExtensionAPI> { |
77 | 113 |
|
78 | 114 | let storagePath = context.storagePath; |
@@ -133,7 +169,9 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> { |
133 | 169 | initializationFailedHandler: error => { |
134 | 170 | logger.error(`Failed to initialize ${extensionName} due to ${error && error.toString()}`); |
135 | 171 | return true; |
136 | | - } |
| 172 | + }, |
| 173 | + outputChannel: new OutputInfoCollector(extensionName), |
| 174 | + outputChannelName: extensionName |
137 | 175 | }; |
138 | 176 |
|
139 | 177 | const item = window.createStatusBarItem(StatusBarAlignment.Right, Number.MIN_VALUE); |
|
0 commit comments