コード例 #1
0
        public async override Task CustomInitializeAsync(
            ILoggerFactory factory,
            StdioServerProcess process)
        {
            LanguageClient = new LanguageClient(factory, process);

            DirectoryInfo testdir =
                Directory.CreateDirectory(Path.Combine(s_binDir, Path.GetRandomFileName()));

            await LanguageClient.Initialize(testdir.FullName);

            // Make sure Script Analysis is enabled because we'll need it in the tests.
            LanguageClient.Workspace.DidChangeConfiguration(JObject.Parse(@"
{
    ""PowerShell"": {
        ""ScriptAnalysis"": {
            ""Enable"": true
        }
    }
}
"));

            Diagnostics = new List <Diagnostic>();
            LanguageClient.TextDocument.OnPublishDiagnostics((uri, diagnostics) =>
            {
                Diagnostics.AddRange(diagnostics.Where(d => d != null));
            });
        }
コード例 #2
0
        public async Task InitializeAsync()
        {
            var factory = new LoggerFactory();

            ProcessStartInfo processStartInfo = new ProcessStartInfo
            {
                FileName = PwshExe
            };

            processStartInfo.ArgumentList.Add("-NoLogo");
            processStartInfo.ArgumentList.Add("-NoProfile");
            processStartInfo.ArgumentList.Add("-EncodedCommand");

            List <string> args = new List <string>
            {
                "&",
                SingleQuoteEscape(Path.Combine(s_bundledModulePath, "PowerShellEditorServices", "Start-EditorServices.ps1")),
                "-LogPath", SingleQuoteEscape(s_logPath),
                "-LogLevel", s_logLevel,
                "-SessionDetailsPath", SingleQuoteEscape(s_sessionDetailsPath),
                "-FeatureFlags", string.Join(',', s_featureFlags),
                "-HostName", s_hostName,
                "-HostProfileId", s_hostProfileId,
                "-HostVersion", s_hostVersion,
                "-AdditionalModules", string.Join(',', s_additionalModules),
                "-BundledModulesPath", SingleQuoteEscape(s_bundledModulePath),
                "-Stdio"
            };

            if (IsDebugAdapterTests)
            {
                args.Add("-DebugServiceOnly");
            }

            string base64Str = Convert.ToBase64String(
                System.Text.Encoding.Unicode.GetBytes(string.Join(' ', args)));

            processStartInfo.ArgumentList.Add(base64Str);

            _psesProcess = new StdioServerProcess(factory, processStartInfo);
            await _psesProcess.Start();

            await CustomInitializeAsync(factory, _psesProcess);
        }
コード例 #3
0
 public abstract Task CustomInitializeAsync(
     ILoggerFactory factory,
     StdioServerProcess process);