forked from PowerShell/PowerShellEditorServices
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEditorServicesConfig.cs
151 lines (128 loc) · 5.35 KB
/
EditorServicesConfig.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System.Collections.Generic;
using System.Management.Automation;
using System.Management.Automation.Host;
using System.Management.Automation.Runspaces;
namespace Microsoft.PowerShell.EditorServices.Hosting
{
/// <summary>
/// Describes the desired console REPL for the integrated console.
/// </summary>
public enum ConsoleReplKind
{
/// <summary>No console REPL - there will be no interactive console available.</summary>
None = 0,
/// <summary>Use a REPL with the legacy readline implementation. This is generally used when PSReadLine is unavailable.</summary>
LegacyReadLine = 1,
/// <summary>Use a REPL with the PSReadLine module for console interaction.</summary>
PSReadLine = 2,
}
/// <summary>
/// Configuration for editor services startup.
/// </summary>
public sealed class EditorServicesConfig
{
/// <summary>
/// Create a new editor services config object,
/// with all required fields.
/// </summary>
/// <param name="hostInfo">The host description object.</param>
/// <param name="psHost">The PowerShell host to use in Editor Services.</param>
/// <param name="sessionDetailsPath">The path to use for the session details file.</param>
/// <param name="bundledModulePath">The path to the modules bundled with Editor Services.</param>
/// <param name="logPath">The path to be used for Editor Services' logging.</param>
public EditorServicesConfig(
HostInfo hostInfo,
PSHost psHost,
string sessionDetailsPath,
string bundledModulePath,
string logPath)
{
HostInfo = hostInfo;
PSHost = psHost;
SessionDetailsPath = sessionDetailsPath;
BundledModulePath = bundledModulePath;
LogPath = logPath;
}
/// <summary>
/// The host description object.
/// </summary>
public HostInfo HostInfo { get; }
/// <summary>
/// The PowerShell host used by Editor Services.
/// </summary>
public PSHost PSHost { get; }
/// <summary>
/// The path to use for the session details file.
/// </summary>
public string SessionDetailsPath { get; }
/// <summary>
/// The path to the modules bundled with EditorServices.
/// </summary>
public string BundledModulePath { get; }
/// <summary>
/// The path to use for logging for Editor Services.
/// </summary>
public string LogPath { get; }
/// <summary>
/// Names of or paths to any additional modules to load on startup.
/// </summary>
public IReadOnlyList<string> AdditionalModules { get; set; } = null;
/// <summary>
/// Flags of features to enable on startup.
/// </summary>
public IReadOnlyList<string> FeatureFlags { get; set; } = null;
/// <summary>
/// The console REPL experience to use in the integrated console
/// (including none to disable the integrated console).
/// </summary>
public ConsoleReplKind ConsoleRepl { get; set; } = ConsoleReplKind.None;
/// <summary>
/// The minimum log level to log events with.
/// </summary>
public PsesLogLevel LogLevel { get; set; } = PsesLogLevel.Normal;
/// <summary>
/// Configuration for the language server protocol transport to use.
/// </summary>
public ITransportConfig LanguageServiceTransport { get; set; } = null;
/// <summary>
/// Configuration for the debug adapter protocol transport to use.
/// </summary>
public ITransportConfig DebugServiceTransport { get; set; } = null;
/// <summary>
/// PowerShell profile locations for Editor Services to use for its profiles.
/// If none are provided, these will be generated from the hosting PowerShell's profile paths.
/// </summary>
public ProfilePathConfig ProfilePaths { get; set; }
/// <summary>
/// The InitialSessionState to use when creating runspaces. LanguageMode can be set here.
/// </summary>
public InitialSessionState InitialSessionState { get; internal set; }
public string StartupBanner { get; set; } = @"
=====> PowerShell Integrated Console <=====
";
}
/// <summary>
/// Configuration for Editor Services' PowerShell profile paths.
/// </summary>
public struct ProfilePathConfig
{
/// <summary>
/// The path to the profile shared by all users across all PowerShell hosts.
/// </summary>
public string AllUsersAllHosts { get; set; }
/// <summary>
/// The path to the profile shared by all users specific to this PSES host.
/// </summary>
public string AllUsersCurrentHost { get; set; }
/// <summary>
/// The path to the profile specific to the current user across all hosts.
/// </summary>
public string CurrentUserAllHosts { get; set; }
/// <summary>
/// The path to the profile specific to the current user and to this PSES host.
/// </summary>
public string CurrentUserCurrentHost { get; set; }
}
}