@@ -5,7 +5,7 @@ import * as fs from 'fs';
5
5
import * as fse from 'fs-extra' ;
6
6
import * as os from 'os' ;
7
7
import * as path from 'path' ;
8
- import { CodeActionContext , commands , ConfigurationTarget , Diagnostic , env , EventEmitter , ExtensionContext , extensions , IndentAction , InputBoxOptions , languages , QuickPickItemKind , RelativePattern , TextDocument , UIKind , Uri , ViewColumn , window , workspace , WorkspaceConfiguration } from 'vscode' ;
8
+ import { CodeActionContext , commands , ConfigurationTarget , Diagnostic , env , EventEmitter , ExtensionContext , extensions , IndentAction , InputBoxOptions , languages , QuickPickItemKind , RelativePattern , TextDocument , TextEditorRevealType , UIKind , Uri , ViewColumn , window , workspace , WorkspaceConfiguration } from 'vscode' ;
9
9
import { CancellationToken , CodeActionParams , CodeActionRequest , Command , CompletionRequest , DidChangeConfigurationNotification , ExecuteCommandParams , ExecuteCommandRequest , LanguageClientOptions , RevealOutputChannelOn } from 'vscode-languageclient' ;
10
10
import { LanguageClient } from 'vscode-languageclient/node' ;
11
11
import { apiManager } from './apiManager' ;
@@ -30,7 +30,6 @@ import { JavaClassEditorProvider } from './javaClassEditor';
30
30
import { StandardLanguageClient } from './standardLanguageClient' ;
31
31
import { SyntaxLanguageClient } from './syntaxLanguageClient' ;
32
32
import { convertToGlob , deleteClientLog , deleteDirectory , ensureExists , getBuildFilePatterns , getExclusionGlob , getInclusionPatternsFromNegatedExclusion , getJavaConfig , getJavaConfiguration , hasBuildToolConflicts , resolveActualCause } from './utils' ;
33
- import glob = require( 'glob' ) ;
34
33
import { Telemetry } from './telemetry' ;
35
34
import { getMessage } from './errorUtils' ;
36
35
import { TelemetryService } from '@redhat-developer/vscode-redhat-telemetry/lib' ;
@@ -39,6 +38,7 @@ import { loadSupportedJreNames } from './jdkUtils';
39
38
import { BuildFileSelector , PICKED_BUILD_FILES , cleanupProjectPickerCache } from './buildFilesSelector' ;
40
39
import { pasteFile } from './pasteAction' ;
41
40
import { ServerStatusKind } from './serverStatus' ;
41
+ import glob = require( 'glob' ) ;
42
42
43
43
const syntaxClient : SyntaxLanguageClient = new SyntaxLanguageClient ( ) ;
44
44
const standardClient : StandardLanguageClient = new StandardLanguageClient ( ) ;
@@ -399,7 +399,16 @@ export async function activate(context: ExtensionContext): Promise<ExtensionAPI>
399
399
context . subscriptions . push ( commands . registerCommand ( Commands . OPEN_FORMATTER , async ( ) => openFormatter ( context . extensionPath ) ) ) ;
400
400
context . subscriptions . push ( commands . registerCommand ( Commands . OPEN_FILE , async ( uri : string ) => {
401
401
const parsedUri = Uri . parse ( uri ) ;
402
- await window . showTextDocument ( parsedUri ) ;
402
+ const editor = await window . showTextDocument ( parsedUri ) ;
403
+ // Reveal the document at the specified line, if possible (e.g. jumping to a specific javadoc method).
404
+ if ( editor && parsedUri . scheme === 'jdt' && parsedUri . fragment ) {
405
+ const line = parseInt ( parsedUri . fragment ) ;
406
+ if ( isNaN ( line ) || line < 1 || line > editor . document . lineCount ) {
407
+ return ;
408
+ }
409
+ const range = editor . document . lineAt ( line - 1 ) . range ;
410
+ editor . revealRange ( range , TextEditorRevealType . AtTop ) ;
411
+ }
403
412
} ) ) ;
404
413
405
414
context . subscriptions . push ( commands . registerCommand ( Commands . CLEAN_WORKSPACE , ( force ?: boolean ) => cleanWorkspace ( workspacePath , force ) ) ) ;
0 commit comments