Archived
1
0

Fix tsc watch restarting when it shouldn't

It seems reaching into lib/vscode for the types caused tsc to establish
watches that caused it to restart over and over while vscode was
building.

The strategy used here is to symlink it instead which is the same thing
we do for the proxy agent.
This commit is contained in:
Asher 2021-04-01 10:57:51 -05:00
parent cbcad39a4f
commit 101c2a01f1
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
9 changed files with 145 additions and 141 deletions

1
lib/vscode/src/vs/ipc.d.ts vendored Symbolic link
View File

@ -0,0 +1 @@
../../../../typings/ipc.d.ts

View File

@ -1,5 +1,6 @@
import * as path from 'vs/base/common/path';
import { URI } from 'vs/base/common/uri';
import { Options } from 'vs/ipc';
import { localize } from 'vs/nls';
import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
@ -11,7 +12,6 @@ import { Registry } from 'vs/platform/registry/common/platform';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { TelemetryChannelClient } from 'vs/server/common/telemetry';
import { Options } from 'vs/server/ipc.d';
import 'vs/workbench/contrib/localizations/browser/localizations.contribution';
import { LocalizationsService } from 'vs/workbench/services/localizations/electron-sandbox/localizationsService';
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';

View File

@ -1,10 +1,10 @@
import { field } from '@coder/logger';
import { setUnexpectedErrorHandler } from 'vs/base/common/errors';
import { CodeServerMessage, VscodeMessage } from 'vs/server/ipc';
import * as proxyAgent from 'vs/base/node/proxy_agent';
import { CodeServerMessage, VscodeMessage } from 'vs/ipc';
import { logger } from 'vs/server/node/logger';
import { enableCustomMarketplace } from 'vs/server/node/marketplace';
import { Vscode } from 'vs/server/node/server';
import * as proxyAgent from 'vs/base/node/proxy_agent';
setUnexpectedErrorHandler((error) => logger.warn(error instanceof Error ? error.message : error));
enableCustomMarketplace();

View File

@ -1,132 +0,0 @@
/**
* External interfaces for integration into code-server over IPC. No vs imports
* should be made in this file.
*/
export interface Options {
base: string
disableTelemetry: boolean
disableUpdateCheck: boolean
}
export interface InitMessage {
type: "init"
id: string
options: VscodeOptions
}
export type Query = { [key: string]: string | string[] | undefined | Query | Query[] }
export interface SocketMessage {
type: "socket"
query: Query
permessageDeflate: boolean
}
export interface CliMessage {
type: "cli"
args: Args
}
export interface OpenCommandPipeArgs {
type: "open"
fileURIs?: string[]
folderURIs: string[]
forceNewWindow?: boolean
diffMode?: boolean
addMode?: boolean
gotoLineMode?: boolean
forceReuseWindow?: boolean
waitMarkerFilePath?: string
}
export type CodeServerMessage = InitMessage | SocketMessage | CliMessage
export interface ReadyMessage {
type: "ready"
}
export interface OptionsMessage {
id: string
type: "options"
options: WorkbenchOptions
}
export type VscodeMessage = ReadyMessage | OptionsMessage
export interface StartPath {
url: string
workspace: boolean
}
export interface Args {
"user-data-dir"?: string
"enable-proposed-api"?: string[]
"extensions-dir"?: string
"builtin-extensions-dir"?: string
"extra-extensions-dir"?: string[]
"extra-builtin-extensions-dir"?: string[]
"ignore-last-opened"?: boolean
locale?: string
log?: string
verbose?: boolean
_: string[]
}
export interface VscodeOptions {
readonly args: Args
readonly remoteAuthority: string
readonly startPath?: StartPath
}
export interface VscodeOptionsMessage extends VscodeOptions {
readonly id: string
}
export interface UriComponents {
readonly scheme: string
readonly authority: string
readonly path: string
readonly query: string
readonly fragment: string
}
export interface NLSConfiguration {
locale: string
availableLanguages: {
[key: string]: string
}
pseudo?: boolean
_languagePackSupport?: boolean
}
export interface WorkbenchOptions {
readonly workbenchWebConfiguration: {
readonly remoteAuthority?: string
readonly folderUri?: UriComponents
readonly workspaceUri?: UriComponents
readonly logLevel?: number
readonly workspaceProvider?: {
payload: [["userDataPath", string], ["enableProposedApi", string]]
}
}
readonly remoteUserDataUri: UriComponents
readonly productConfiguration: {
codeServerVersion?: string
readonly extensionsGallery?: {
readonly serviceUrl: string
readonly itemUrl: string
readonly controlUrl: string
readonly recommendationsUrl: string
}
}
readonly nlsConfiguration: NLSConfiguration
readonly commit: string
}
export interface WorkbenchOptionsMessage {
id: string
}

View File

@ -1,7 +1,7 @@
import { field } from '@coder/logger';
import { release } from 'os';
import * as fs from 'fs';
import * as net from 'net';
import { release } from 'os';
import * as path from 'path';
import { Emitter } from 'vs/base/common/event';
import { Schemas } from 'vs/base/common/network';
@ -10,6 +10,7 @@ import { getMachineId } from 'vs/base/node/id';
import { ClientConnectionEvent, IPCServer, IServerChannel, ProxyChannel } from 'vs/base/parts/ipc/common/ipc';
import { LogsDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/logsDataCleaner';
import { main } from 'vs/code/node/cliProcessMain';
import { Query, VscodeOptions, WorkbenchOptions } from 'vs/ipc';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ConfigurationService } from 'vs/platform/configuration/common/configurationService';
import { ExtensionHostDebugBroadcastChannel } from 'vs/platform/debug/common/extensionHostDebugIpc';
@ -40,14 +41,13 @@ import { IRequestService } from 'vs/platform/request/common/request';
import { RequestChannel } from 'vs/platform/request/common/requestIpc';
import { RequestService } from 'vs/platform/request/node/requestService';
import ErrorTelemetry from 'vs/platform/telemetry/browser/errorTelemetry';
import { resolveCommonProperties } from 'vs/platform/telemetry/common/commonProperties';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { TelemetryLogAppender } from 'vs/platform/telemetry/common/telemetryLogAppender';
import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
import { combinedAppender, NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppender';
import { resolveCommonProperties } from 'vs/platform/telemetry/common/commonProperties';
import { TelemetryChannel } from 'vs/server/common/telemetry';
import { Query, VscodeOptions, WorkbenchOptions } from 'vs/server/ipc';
import { ExtensionEnvironmentChannel, FileProviderChannel, TerminalProviderChannel } from 'vs/server/node/channel';
import { Connection, ExtensionHostConnection, ManagementConnection } from 'vs/server/node/connection';
import { TelemetryClient } from 'vs/server/node/insights';

View File

@ -3,7 +3,7 @@ import { promises as fs } from "fs"
import yaml from "js-yaml"
import * as os from "os"
import * as path from "path"
import { Args as VsArgs } from "../../lib/vscode/src/vs/server/ipc"
import { Args as VsArgs } from "../../typings/ipc"
import { canConnect, generateCertificate, generatePassword, humanPath, paths } from "./util"
export enum AuthType {

View File

@ -2,7 +2,7 @@ import { field, logger } from "@coder/logger"
import * as cp from "child_process"
import http from "http"
import * as path from "path"
import { CliMessage, OpenCommandPipeArgs } from "../../lib/vscode/src/vs/server/ipc"
import { CliMessage, OpenCommandPipeArgs } from "../../typings/ipc"
import { plural } from "../common/util"
import { createApp, ensureAddress } from "./app"
import {

View File

@ -2,7 +2,7 @@ import { logger } from "@coder/logger"
import * as cp from "child_process"
import * as net from "net"
import * as path from "path"
import * as ipc from "../../lib/vscode/src/vs/server/ipc"
import * as ipc from "../../typings/ipc"
import { arrayify, generateUuid } from "../common/util"
import { rootPath } from "./constants"
import { settings } from "./settings"

135
typings/ipc.d.ts vendored Normal file
View File

@ -0,0 +1,135 @@
/**
* External interfaces for integration into code-server over IPC.
* This file exists in two locations:
* - typings/ipc.d.ts
* - lib/vscode/src/typings/ipc.d.ts
* The second is a symlink to the first.
*/
export interface Options {
base: string
disableTelemetry: boolean
disableUpdateCheck: boolean
}
export interface InitMessage {
type: "init"
id: string
options: VscodeOptions
}
export type Query = { [key: string]: string | string[] | undefined | Query | Query[] }
export interface SocketMessage {
type: "socket"
query: Query
permessageDeflate: boolean
}
export interface CliMessage {
type: "cli"
args: Args
}
export interface OpenCommandPipeArgs {
type: "open"
fileURIs?: string[]
folderURIs: string[]
forceNewWindow?: boolean
diffMode?: boolean
addMode?: boolean
gotoLineMode?: boolean
forceReuseWindow?: boolean
waitMarkerFilePath?: string
}
export type CodeServerMessage = InitMessage | SocketMessage | CliMessage
export interface ReadyMessage {
type: "ready"
}
export interface OptionsMessage {
id: string
type: "options"
options: WorkbenchOptions
}
export type VscodeMessage = ReadyMessage | OptionsMessage
export interface StartPath {
url: string
workspace: boolean
}
export interface Args {
"user-data-dir"?: string
"enable-proposed-api"?: string[]
"extensions-dir"?: string
"builtin-extensions-dir"?: string
"extra-extensions-dir"?: string[]
"extra-builtin-extensions-dir"?: string[]
"ignore-last-opened"?: boolean
locale?: string
log?: string
verbose?: boolean
_: string[]
}
export interface VscodeOptions {
readonly args: Args
readonly remoteAuthority: string
readonly startPath?: StartPath
}
export interface VscodeOptionsMessage extends VscodeOptions {
readonly id: string
}
export interface UriComponents {
readonly scheme: string
readonly authority: string
readonly path: string
readonly query: string
readonly fragment: string
}
export interface NLSConfiguration {
locale: string
availableLanguages: {
[key: string]: string
}
pseudo?: boolean
_languagePackSupport?: boolean
}
export interface WorkbenchOptions {
readonly workbenchWebConfiguration: {
readonly remoteAuthority?: string
readonly folderUri?: UriComponents
readonly workspaceUri?: UriComponents
readonly logLevel?: number
readonly workspaceProvider?: {
payload: [["userDataPath", string], ["enableProposedApi", string]]
}
}
readonly remoteUserDataUri: UriComponents
readonly productConfiguration: {
codeServerVersion?: string
readonly extensionsGallery?: {
readonly serviceUrl: string
readonly itemUrl: string
readonly controlUrl: string
readonly recommendationsUrl: string
}
}
readonly nlsConfiguration: NLSConfiguration
readonly commit: string
}
export interface WorkbenchOptionsMessage {
id: string
}