1
1
'use strict' ;
2
2
3
- import { ExtensionContext , window , workspace , commands , Uri , ProgressLocation , ViewColumn , EventEmitter , extensions , Location , languages , CodeActionKind , TextEditor , CancellationToken , ConfigurationTarget } from "vscode" ;
4
- import { Commands } from "./commands" ;
5
- import { serverStatus , ServerStatusKind } from "./serverStatus" ;
6
- import { prepareExecutable , awaitServerConnection } from "./javaServerStarter" ;
7
- import { LanguageClientOptions , Position as LSPosition , Location as LSLocation , MessageType , TextDocumentPositionParams , ConfigurationRequest , ConfigurationParams } from "vscode-languageclient" ;
8
- import { LanguageClient , StreamInfo } from "vscode-languageclient/node" ;
9
- import { CompileWorkspaceRequest , CompileWorkspaceStatus , SourceAttachmentRequest , SourceAttachmentResult , SourceAttachmentAttribute , FeatureStatus , StatusNotification , ProgressReportNotification , ActionableNotification , ExecuteClientCommandRequest , ServerNotification , EventNotification , EventType , LinkLocation , FindLinks , GradleCompatibilityInfo , UpgradeGradleWrapperInfo , BuildProjectRequest , BuildProjectParams } from "./protocol" ;
10
- import { setGradleWrapperChecksum , excludeProjectSettingsFiles , ServerMode } from "./settings" ;
11
- import { onExtensionChange , collectBuildFilePattern } from "./plugin" ;
12
- import { activationProgressNotification , serverTaskPresenter } from "./serverTaskPresenter" ;
13
- import { getJdkUrl , RequirementsData , sortJdksBySource , sortJdksByVersion } from "./requirements" ;
14
- import * as net from 'net' ;
15
3
import * as fse from 'fs-extra' ;
4
+ import { findRuntimes } from "jdk-utils" ;
5
+ import * as net from 'net' ;
16
6
import * as path from 'path' ;
17
- import { getAllJavaProjects , getJavaConfig , getJavaConfiguration } from "./utils" ;
18
- import { logger } from "./log" ;
19
- import * as buildPath from './buildpath' ;
20
- import * as sourceAction from './sourceAction' ;
21
- import * as refactorAction from './refactorAction' ;
22
- import * as pasteAction from './pasteAction' ;
23
- import { serverTasks } from "./serverTasks" ;
7
+ import { CancellationToken , CodeActionKind , commands , ConfigurationTarget , DocumentSelector , EventEmitter , ExtensionContext , extensions , languages , Location , ProgressLocation , TextEditor , Uri , ViewColumn , window , workspace } from "vscode" ;
8
+ import { ConfigurationParams , ConfigurationRequest , LanguageClientOptions , Location as LSLocation , MessageType , Position as LSPosition , TextDocumentPositionParams } from "vscode-languageclient" ;
9
+ import { LanguageClient , StreamInfo } from "vscode-languageclient/node" ;
24
10
import { apiManager } from "./apiManager" ;
25
- import { ExtensionAPI , ClientStatus } from "./extension.api" ;
26
- import { serverStatusBarProvider } from "./serverStatusBarProvider" ;
11
+ import * as buildPath from './buildpath' ;
12
+ import { javaRefactorKinds , RefactorDocumentProvider } from "./codeActionProvider" ;
13
+ import { Commands } from "./commands" ;
14
+ import { ClientStatus , ExtensionAPI } from "./extension.api" ;
27
15
import * as fileEventHandler from './fileEventHandler' ;
16
+ import { gradleCodeActionMetadata , GradleCodeActionProvider } from "./gradle/gradleCodeActionProvider" ;
17
+ import { JavaInlayHintsProvider } from "./inlayHintsProvider" ;
18
+ import { awaitServerConnection , prepareExecutable } from "./javaServerStarter" ;
19
+ import { logger } from "./log" ;
20
+ import { checkLombokDependency } from "./lombokSupport" ;
28
21
import { markdownPreviewProvider } from "./markdownPreviewProvider" ;
29
- import { RefactorDocumentProvider , javaRefactorKinds } from "./codeActionProvider" ;
30
- import { typeHierarchyTree } from "./typeHierarchy/typeHierarchyTree" ;
31
- import { TypeHierarchyDirection , TypeHierarchyItem } from "./typeHierarchy/protocol " ;
22
+ import * as pasteAction from './pasteAction' ;
23
+ import { registerPasteEventHandler } from './pasteEventHandler' ;
24
+ import { collectBuildFilePattern , onExtensionChange } from "./plugin " ;
32
25
import { pomCodeActionMetadata , PomCodeActionProvider } from "./pom/pomCodeActionProvider" ;
33
- import { findRuntimes } from "jdk-utils" ;
26
+ import { ActionableNotification , BuildProjectParams , BuildProjectRequest , CompileWorkspaceRequest , CompileWorkspaceStatus , EventNotification , EventType , ExecuteClientCommandRequest , FeatureStatus , FindLinks , GradleCompatibilityInfo , LinkLocation , ProgressReportNotification , ServerNotification , SourceAttachmentAttribute , SourceAttachmentRequest , SourceAttachmentResult , StatusNotification , UpgradeGradleWrapperInfo } from "./protocol" ;
27
+ import * as refactorAction from './refactorAction' ;
28
+ import { getJdkUrl , RequirementsData , sortJdksBySource , sortJdksByVersion } from "./requirements" ;
29
+ import { serverStatus , ServerStatusKind } from "./serverStatus" ;
30
+ import { serverStatusBarProvider } from "./serverStatusBarProvider" ;
31
+ import { activationProgressNotification , serverTaskPresenter } from "./serverTaskPresenter" ;
32
+ import { serverTasks } from "./serverTasks" ;
33
+ import { excludeProjectSettingsFiles , ServerMode , setGradleWrapperChecksum } from "./settings" ;
34
34
import { snippetCompletionProvider } from "./snippetCompletionProvider" ;
35
- import { JavaInlayHintsProvider } from "./inlayHintsProvider" ;
36
- import { gradleCodeActionMetadata , GradleCodeActionProvider } from "./gradle/gradleCodeActionProvider" ;
37
- import { checkLombokDependency } from "./lombokSupport" ;
35
+ import * as sourceAction from './sourceAction' ;
38
36
import { askForProjects , projectConfigurationUpdate , upgradeGradle } from "./standardLanguageClientUtils" ;
37
+ import { TypeHierarchyDirection , TypeHierarchyItem } from "./typeHierarchy/protocol" ;
38
+ import { typeHierarchyTree } from "./typeHierarchy/typeHierarchyTree" ;
39
+ import { getAllJavaProjects , getJavaConfig , getJavaConfiguration } from "./utils" ;
39
40
40
41
const extensionName = 'Language Support for Java' ;
41
42
const GRADLE_CHECKSUM = "gradle/checksum/prompt" ;
@@ -44,6 +45,11 @@ const USE_JAVA = "Use Java ";
44
45
const AS_GRADLE_JVM = " as Gradle JVM" ;
45
46
const UPGRADE_GRADLE = "Upgrade Gradle to " ;
46
47
const GRADLE_IMPORT_JVM = "java.import.gradle.java.home" ;
48
+ export const JAVA_SELECTOR : DocumentSelector = [
49
+ { scheme : "file" , language : "java" , pattern : "**/*.java" } ,
50
+ { scheme : "jdt" , language : "java" , pattern : "**/*.class" } ,
51
+ { scheme : "untitled" , language : "java" , pattern : "**/*.java" }
52
+ ] ;
47
53
48
54
export class StandardLanguageClient {
49
55
@@ -588,12 +594,10 @@ export class StandardLanguageClient {
588
594
} , new GradleCodeActionProvider ( context ) , gradleCodeActionMetadata ) ;
589
595
590
596
if ( languages . registerInlayHintsProvider ) {
591
- context . subscriptions . push ( languages . registerInlayHintsProvider ( [
592
- { scheme : "file" , language : "java" , pattern : "**/*.java" } ,
593
- { scheme : "jdt" , language : "java" , pattern : "**/*.class" } ,
594
- { scheme : "untitled" , language : "java" , pattern : "**/*.java" }
595
- ] , new JavaInlayHintsProvider ( this . languageClient ) ) ) ;
597
+ context . subscriptions . push ( languages . registerInlayHintsProvider ( JAVA_SELECTOR , new JavaInlayHintsProvider ( this . languageClient ) ) ) ;
596
598
}
599
+
600
+ registerPasteEventHandler ( context , this . languageClient ) ;
597
601
} ) ;
598
602
}
599
603
0 commit comments