This repository was archived by the owner on Mar 21, 2023. It is now read-only.
File tree 5 files changed +44
-8
lines changed
5 files changed +44
-8
lines changed Original file line number Diff line number Diff line change 1
- import { WorkspaceConfiguration } from "./interfaces/WorkspaceConfiguration" ;
2
- import { ConfigurationTarget } from "./interfaces/ConfigurationTarget" ;
3
1
import * as semver from "semver" ;
2
+ import { ConfigurationTarget } from "./interfaces/ConfigurationTarget" ;
3
+ import { UserConfiguration } from "./interfaces/UserConfiguration" ;
4
+ import { WorkspaceConfiguration } from "./interfaces/WorkspaceConfiguration" ;
4
5
5
6
interface OnOutdatedParams {
6
7
message : string ;
@@ -16,7 +17,7 @@ interface UpdateConfigParams {
16
17
configurationTarget : ConfigurationTarget ;
17
18
}
18
19
19
- const configSection = "serverVersion" ;
20
+ const configSection = UserConfiguration . ServerVersion ;
20
21
21
22
interface CheckServerVersionParams {
22
23
config : WorkspaceConfiguration ;
Original file line number Diff line number Diff line change
1
+ import { UserConfiguration } from "./interfaces/UserConfiguration" ;
1
2
import { Workspace } from "./interfaces/Workspace" ;
2
3
3
4
interface PromptRestartParams {
@@ -13,10 +14,11 @@ export function detectLaunchConfigurationChanges(
13
14
) : void {
14
15
workspace . onDidChangeConfiguration ( ( e ) => {
15
16
const promptRestartKeys = [
16
- "serverVersion" ,
17
- "serverProperties" ,
18
- "javaHome" ,
19
- "customRepositories" ,
17
+ UserConfiguration . ServerVersion ,
18
+ UserConfiguration . ServerProperties ,
19
+ UserConfiguration . JavaHome ,
20
+ UserConfiguration . CustomRepositories ,
21
+ UserConfiguration . CoursierMirror ,
20
22
...additionalRestartKeys ,
21
23
] ;
22
24
const shouldPromptRestart = promptRestartKeys . some ( ( key ) =>
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ export interface JavaConfig {
5
5
javaOptions : string [ ] ;
6
6
javaPath : string ;
7
7
coursierPath : string ;
8
+ coursierMirrorFilePath : string | undefined ;
8
9
extraEnv : {
9
10
[ k : string ] : string | undefined ;
10
11
} ;
@@ -14,27 +15,31 @@ interface GetJavaConfigOptions {
14
15
workspaceRoot : string | undefined ;
15
16
javaHome : string ;
16
17
extensionPath : string ;
18
+ coursierMirrorFilePath : string | undefined ;
17
19
customRepositories : string [ ] | undefined ;
18
20
}
19
21
20
22
export function getJavaConfig ( {
21
23
workspaceRoot,
22
24
javaHome,
23
25
extensionPath,
26
+ coursierMirrorFilePath,
24
27
customRepositories = [ ] ,
25
28
} : GetJavaConfigOptions ) : JavaConfig {
26
29
const javaOptions = getJavaOptions ( workspaceRoot ) ;
27
30
const javaPath = path . join ( javaHome , "bin" , "java" ) ;
28
31
const coursierPath = path . join ( extensionPath , "./coursier" ) ;
29
32
const extraEnv = {
30
33
COURSIER_REPOSITORIES : customRepositories . join ( "|" ) ,
34
+ COURSIER_MIRRORS : coursierMirrorFilePath ,
31
35
JAVA_HOME : javaHome ,
32
36
} ;
33
37
34
38
return {
35
39
javaOptions,
36
40
javaPath,
37
41
coursierPath,
42
+ coursierMirrorFilePath,
38
43
extraEnv,
39
44
} ;
40
45
}
Original file line number Diff line number Diff line change 2
2
* These are all of the client commands that Metals supports. Note that not support
3
3
* may vary based on the `InitializationSettings` the client sets.
4
4
*
5
- * - https://scalameta.org/metals/docs/editors /new-editor.html #metals-client-commands
5
+ * - https://scalameta.org/metals/docs/integrations /new-editor#metals-client-commands
6
6
*/
7
7
export const ClientCommands = {
8
8
/**
Original file line number Diff line number Diff line change
1
+ /**
2
+ * These are some of the common user configuration options used in Metals and needed for the editors.
3
+ *
4
+ * - https://scalameta.org/metals/docs/integrations/new-editor#metals-user-configuration
5
+ */
6
+ export enum UserConfiguration {
7
+ /**
8
+ * Metals server version
9
+ */
10
+ ServerVersion = "serverVersion" ,
11
+ /**
12
+ * Metals server Java properties
13
+ */
14
+ ServerProperties = "serverProperties" ,
15
+ /**
16
+ * Directory containing the Java binary.
17
+ */
18
+ JavaHome = "javaHome" ,
19
+ /**
20
+ * Additional repositories that can be used to download dependencies.
21
+ * https://get-coursier.io/docs/other-repositories
22
+ */
23
+ CustomRepositories = "customRepositories" ,
24
+ /**
25
+ * Repository to use instead of maven central for example `https://jcenter.bintray.com`
26
+ */
27
+ CoursierMirror = "coursierMirror" ,
28
+ }
You can’t perform that action at this time.
0 commit comments