vscode
Submodule
Constructs
DevContainer
- Implements: IDevContainerEnvironment
A development environment running VSCode in a container;
used by GitHub codespaces.
Initializers
import { vscode } from 'projen'
new vscode.DevContainer(project: Project, options?: DevContainerOptions)
Name | Type | Description |
---|---|---|
| projen.Project | No description. |
|
| No description. |
project
Required
- Type: projen.Project
options
Optional
- Type: DevContainerOptions
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Add a custom Docker image or Dockerfile for the container. |
| Adds a list of VSCode features that should be automatically installed in the container. |
| Adds ports that should be exposed (forwarded) from the container. |
| Adds tasks to run when the container starts. |
| Adds a list of VSCode extensions that should be automatically installed in the container. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addDockerImage
public addDockerImage(image: DevEnvironmentDockerImage): void
Add a custom Docker image or Dockerfile for the container.
image
Required
- Type: projen.DevEnvironmentDockerImage
addFeatures
public addFeatures(features: ...DevContainerFeature[]): void
Adds a list of VSCode features that should be automatically installed in the container.
features
Required
- Type: ...DevContainerFeature[]
featureName and version(optional default: latest).
addPorts
public addPorts(ports: ...string[]): void
Adds ports that should be exposed (forwarded) from the container.
ports
Required
- Type: ...string[]
The new ports.
addTasks
public addTasks(tasks: ...Task[]): void
Adds tasks to run when the container starts.
Tasks will be run in sequence.
tasks
Required
- Type: ...projen.Task[]
The new tasks.
addVscodeExtensions
public addVscodeExtensions(extensions: ...string[]): void
Adds a list of VSCode extensions that should be automatically installed in the container.
extensions
Required
- Type: ...string[]
The extension IDs.
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { vscode } from 'projen'
vscode.DevContainer.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required
- Type: any
Any object.
isComponent
import { vscode } from 'projen'
vscode.DevContainer.isComponent(x: any)
Test whether the given construct is a component.
x
Required
- Type: any
Properties
Name | Type | Description |
---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| any | Direct access to the devcontainer configuration (escape hatch). |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
config
Required
public readonly config: any;
- Type: any
Direct access to the devcontainer configuration (escape hatch).
VsCode
Initializers
import { vscode } from 'projen'
new vscode.VsCode(project: Project)
Name | Type | Description |
---|---|---|
| projen.Project | No description. |
project
Required
- Type: projen.Project
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { vscode } from 'projen'
vscode.VsCode.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required
- Type: any
Any object.
isComponent
import { vscode } from 'projen'
vscode.VsCode.isComponent(x: any)
Test whether the given construct is a component.
x
Required
- Type: any
Properties
Name | Type | Description |
---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
|
| No description. |
|
| No description. |
|
| No description. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
extensions
Required
public readonly extensions: VsCodeRecommendedExtensions;
launchConfiguration
Required
public readonly launchConfiguration: VsCodeLaunchConfig;
- Type: VsCodeLaunchConfig
settings
Required
public readonly settings: VsCodeSettings;
- Type: VsCodeSettings
VsCodeLaunchConfig
VSCode launch configuration file (launch.json), useful for enabling in-editor debugger.
Initializers
import { vscode } from 'projen'
new vscode.VsCodeLaunchConfig(vscode: VsCode)
Name | Type | Description |
---|---|---|
|
| No description. |
vscode
Required
- Type: VsCode
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Adds an input variable with type command to .vscode/launch.json . |
| Adds a VsCodeLaunchConfigurationEntry (e.g. a node.js debugger) to `.vscode/launch.json. Each configuration entry has following mandatory fields: type, request and name. See https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes for details. |
| Adds an input variable with type pickString to .vscode/launch.json . |
| Adds an input variable with type promptString to .vscode/launch.json . |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addCommandInput
public addCommandInput(cfg: VsCodeLaunchCommandInputEntry): void
Adds an input variable with type command
to .vscode/launch.json
.
See https://code.visualstudio.com/docs/editor/variables-reference#_input-variables for details.
cfg
Required
VsCodeLaunchCommandInputEntry.
addConfiguration
public addConfiguration(cfg: VsCodeLaunchConfigurationEntry): void
Adds a VsCodeLaunchConfigurationEntry (e.g. a node.js debugger) to `.vscode/launch.json. Each configuration entry has following mandatory fields: type, request and name. See https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes for details.
cfg
Required
VsCodeLaunchConfigurationEntry.
addPickStringInput
public addPickStringInput(cfg: VsCodeLaunchPickStringInputEntry): void
Adds an input variable with type pickString
to .vscode/launch.json
.
See https://code.visualstudio.com/docs/editor/variables-reference#_input-variables for details.
cfg
Required
VsCodeLaunchPickStringInputEntry.
addPromptStringInput
public addPromptStringInput(cfg: VsCodeLaunchPromptStringInputEntry): void
Adds an input variable with type promptString
to .vscode/launch.json
.
See https://code.visualstudio.com/docs/editor/variables-reference#_input-variables for details.
cfg
Required
VsCodeLaunchPromptStringInputEntry.
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { vscode } from 'projen'
vscode.VsCodeLaunchConfig.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required
- Type: any
Any object.
isComponent
import { vscode } from 'projen'
vscode.VsCodeLaunchConfig.isComponent(x: any)
Test whether the given construct is a component.
x
Required
- Type: any
Properties
Name | Type | Description |
---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| projen.JsonFile | No description. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
file
Required
public readonly file: JsonFile;
- Type: projen.JsonFile
VsCodeRecommendedExtensions
VS Code Workspace recommended extensions Source: https://code.visualstudio.com/docs/editor/extension-marketplace#_workspace-recommended-extensions.
Initializers
import { vscode } from 'projen'
new vscode.VsCodeRecommendedExtensions(vscode: VsCode)
Name | Type | Description |
---|---|---|
|
| No description. |
vscode
Required
- Type: VsCode
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Adds a list of VS Code extensions as recommendations for this workspace. |
| Marks a list of VS Code extensions as unwanted recommendations for this workspace. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addRecommendations
public addRecommendations(extensions: ...string[]): void
Adds a list of VS Code extensions as recommendations for this workspace.
extensions
Required
- Type: ...string[]
The extension IDs.
addUnwantedRecommendations
public addUnwantedRecommendations(extensions: ...string[]): void
Marks a list of VS Code extensions as unwanted recommendations for this workspace.
VS Code should not be recommend these extensions for users of this workspace.
extensions
Required
- Type: ...string[]
The extension IDs.
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { vscode } from 'projen'
vscode.VsCodeRecommendedExtensions.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required
- Type: any
Any object.
isComponent
import { vscode } from 'projen'
vscode.VsCodeRecommendedExtensions.isComponent(x: any)
Test whether the given construct is a component.
x
Required
- Type: any
Properties
Name | Type | Description |
---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| projen.JsonFile | No description. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
file
Required
public readonly file: JsonFile;
- Type: projen.JsonFile
VsCodeSettings
VS Code Workspace settings Source: https://code.visualstudio.com/docs/getstarted/settings#_workspace-settings.
Initializers
import { vscode } from 'projen'
new vscode.VsCodeSettings(vscode: VsCode)
Name | Type | Description |
---|---|---|
|
| No description. |
vscode
Required
- Type: VsCode
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Adds a workspace setting. |
| Adds a workspace setting. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addSetting
public addSetting(setting: string, value: any, language?: string): void
Adds a workspace setting.
setting
Required
- Type: string
The setting ID.
value
Required
- Type: any
The value of the setting.
language
Optional
- Type: string
Scope the setting to a specific language.
addSettings
public addSettings(settings: {[ key: string ]: any}, languages?: string | string[]): void
Adds a workspace setting.
settings
Required
- Type: {[ key: string ]: any}
Array structure: [setting: string, value: any, languages?: string[]].
languages
Optional
- Type: string | string[]
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { vscode } from 'projen'
vscode.VsCodeSettings.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required
- Type: any
Any object.
isComponent
import { vscode } from 'projen'
vscode.VsCodeSettings.isComponent(x: any)
Test whether the given construct is a component.
x
Required
- Type: any
Properties
Name | Type | Description |
---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| projen.JsonFile | No description. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
file
Required
public readonly file: JsonFile;
- Type: projen.JsonFile
Structs
DevContainerFeature
devcontainer features options.
https://containers.dev/implementors/features/#devcontainer-json-properties
Initializer
import { vscode } from 'projen'
const devContainerFeature: vscode.DevContainerFeature = { ... }
Properties
Name | Type | Description |
---|---|---|
| string | feature name. |
| string | feature version. |
name
Required
public readonly name: string;
- Type: string
feature name.
version
Optional
public readonly version: string;
- Type: string
- Default: latest
feature version.
DevContainerOptions
Constructor options for the DevContainer component.
The default docker image used for GitHub Codespaces is defined here:
https://github.com/microsoft/vscode-dev-containers/tree/master/containers/codespaces-linux
Initializer
import { vscode } from 'projen'
const devContainerOptions: vscode.DevContainerOptions = { ... }
Properties
Name | Type | Description |
---|---|---|
| projen.DevEnvironmentDockerImage | A Docker image or Dockerfile for the container. |
| string[] | An array of ports that should be exposed from the container. |
| projen.Task[] | An array of tasks that should be run when the container starts. |
| string[] | An array of extension IDs that specify the extensions that should be installed inside the container when it is created. |
|
| An array of VSCode features that specify the features that should be installed inside the container when it is created. |
dockerImage
Optional
public readonly dockerImage: DevEnvironmentDockerImage;
- Type: projen.DevEnvironmentDockerImage
A Docker image or Dockerfile for the container.
ports
Optional
public readonly ports: string[];
- Type: string[]
An array of ports that should be exposed from the container.
tasks
Optional
public readonly tasks: Task[];
- Type: projen.Task[]
An array of tasks that should be run when the container starts.
vscodeExtensions
Optional
public readonly vscodeExtensions: string[];
- Type: string[]
An array of extension IDs that specify the extensions that should be installed inside the container when it is created.
features
Optional
public readonly features: DevContainerFeature[];
- Type: DevContainerFeature[]
An array of VSCode features that specify the features that should be installed inside the container when it is created.
Presentation
VSCode launch configuration Presentation interface "using the order, group, and hidden attributes in the presentation object you can sort, group, and hide configurations and compounds in the Debug configuration dropdown and in the Debug quick pick." Source: https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes.
Initializer
import { vscode } from 'projen'
const presentation: vscode.Presentation = { ... }
Properties
Name | Type | Description |
---|---|---|
| string | No description. |
| boolean | No description. |
| number | No description. |
group
Required
public readonly group: string;
- Type: string
hidden
Required
public readonly hidden: boolean;
- Type: boolean
order
Required
public readonly order: number;
- Type: number
ServerReadyAction
VSCode launch configuration ServerReadyAction interface "if you want to open a URL in a web browser whenever the program under debugging outputs a specific message to the debug console or integrated terminal." Source: https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes.
Initializer
import { vscode } from 'projen'
const serverReadyAction: vscode.ServerReadyAction = { ... }
Properties
Name | Type | Description |
---|---|---|
| string | No description. |
| string | No description. |
| string | No description. |
action
Required
public readonly action: string;
- Type: string
pattern
Optional
public readonly pattern: string;
- Type: string
uriFormat
Optional
public readonly uriFormat: string;
- Type: string
VsCodeLaunchCommandInputEntry
Options for a 'VsCodeLaunchCommandInputEntry' Source: https://code.visualstudio.com/docs/editor/variables-reference#_input-variables.
Initializer
import { vscode } from 'projen'
const vsCodeLaunchCommandInputEntry: vscode.VsCodeLaunchCommandInputEntry = { ... }
Properties
Name | Type | Description |
---|---|---|
| string | No description. |
| string | No description. |
| any | No description. |
id
Required
public readonly id: string;
- Type: string
command
Required
public readonly command: string;
- Type: string
args
Optional
public readonly args: any;
- Type: any
VsCodeLaunchConfigurationEntry
Options for a 'VsCodeLaunchConfigurationEntry' Source: https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes.
Initializer
import { vscode } from 'projen'
const vsCodeLaunchConfigurationEntry: vscode.VsCodeLaunchConfigurationEntry = { ... }
Properties
Name | Type | Description |
---|---|---|
| string | No description. |
| string | No description. |
| string | No description. |
| string[] | No description. |
|
| No description. |
| string | No description. |
| number | No description. |
| boolean | No description. |
| {[ key: string ]: string | boolean} | Set value to false to unset an existing environment variable. |
| string | No description. |
|
| No description. |
| string[] | No description. |
| number | No description. |
| string | No description. |
| string | No description. |
|
| No description. |
| string | No description. |
| string[] | No description. |
|
| No description. |
| string[] | No description. |
| boolean | No description. |
| string | No description. |
| string | No description. |
name
Required
public readonly name: string;
- Type: string
request
Required
public readonly request: string;
- Type: string
type
Required
public readonly type: string;
- Type: string
args
Optional
public readonly args: string[];
- Type: string[]
console
Optional
public readonly console: Console;
- Type: Console
cwd
Optional
public readonly cwd: string;
- Type: string
debugServer
Optional
public readonly debugServer: number;
- Type: number
disableOptimisticBPs
Optional
public readonly disableOptimisticBPs: boolean;
- Type: boolean
env
Optional
public readonly env: {[ key: string ]: string | boolean};
- Type: {[ key: string ]: string | boolean}
Set value to false
to unset an existing environment variable.
envFile
Optional
public readonly envFile: string;
- Type: string
internalConsoleOptions
Optional
public readonly internalConsoleOptions: InternalConsoleOptions;
- Type: InternalConsoleOptions
outFiles
Optional
public readonly outFiles: string[];
- Type: string[]
port
Optional
public readonly port: number;
- Type: number
postDebugTask
Optional
public readonly postDebugTask: string;
- Type: string
preLaunchTask
Optional
public readonly preLaunchTask: string;
- Type: string
presentation
Optional
public readonly presentation: Presentation;
- Type: Presentation
program
Optional
public readonly program: string;
- Type: string
runtimeArgs
Optional
public readonly runtimeArgs: string[];
- Type: string[]
serverReadyAction
Optional
public readonly serverReadyAction: ServerReadyAction;
- Type: ServerReadyAction
skipFiles
Optional
public readonly skipFiles: string[];
- Type: string[]
stopOnEntry
Optional
public readonly stopOnEntry: boolean;
- Type: boolean
url
Optional
public readonly url: string;
- Type: string
webRoot
Optional
public readonly webRoot: string;
- Type: string
VsCodeLaunchInputEntry
Base options for a 'VsCodeLaunchInputEntry' Source: https://code.visualstudio.com/docs/editor/variables-reference#_input-variables.
Initializer
import { vscode } from 'projen'
const vsCodeLaunchInputEntry: vscode.VsCodeLaunchInputEntry = { ... }
Properties
Name | Type | Description |
---|---|---|
| string | No description. |
id
Required
public readonly id: string;
- Type: string
VsCodeLaunchPickStringInputEntry
Options for a 'VsCodeLaunchPickStringInputEntry' Source: https://code.visualstudio.com/docs/editor/variables-reference#_input-variables.
Initializer
import { vscode } from 'projen'
const vsCodeLaunchPickStringInputEntry: vscode.VsCodeLaunchPickStringInputEntry = { ... }
Properties
Name | Type | Description |
---|---|---|
| string | No description. |
| string | No description. |
| string[] | No description. |
| string | No description. |
id
Required
public readonly id: string;
- Type: string
description
Required
public readonly description: string;
- Type: string
options
Required
public readonly options: string[];
- Type: string[]
default
Optional
public readonly default: string;
- Type: string
VsCodeLaunchPromptStringInputEntry
Options for a 'VsCodeLaunchPromptStringInputEntry' Source: https://code.visualstudio.com/docs/editor/variables-reference#_input-variables.
Initializer
import { vscode } from 'projen'
const vsCodeLaunchPromptStringInputEntry: vscode.VsCodeLaunchPromptStringInputEntry = { ... }
Properties
Name | Type | Description |
---|---|---|
| string | No description. |
| string | No description. |
| string | No description. |
| boolean | No description. |
id
Required
public readonly id: string;
- Type: string
description
Required
public readonly description: string;
- Type: string
default
Optional
public readonly default: string;
- Type: string
password
Optional
public readonly password: boolean;
- Type: boolean
Protocols
IDevContainerEnvironment
-
Extends: projen.IDevEnvironment
-
Implemented By: DevContainer, IDevContainerEnvironment
Methods
Name | Description |
---|---|
| Adds a list of VSCode features that should be automatically installed in the container. |
addFeatures
public addFeatures(features: ...DevContainerFeature[]): void
Adds a list of VSCode features that should be automatically installed in the container.
features
Required
- Type: ...DevContainerFeature[]
featureName and version(optional default: latest).
Enums
Console
Controls where to launch the debug target Source: https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes.
Members
Name | Description |
---|---|
| No description. |
| No description. |
| No description. |
INTERNAL_CONSOLE
INTEGRATED_TERMINAL
EXTERNAL_TERMINAL
InternalConsoleOptions
Controls the visibility of the VSCode Debug Console panel during a debugging session Source: https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes.
Members
Name | Description |
---|---|
| No description. |
| No description. |
| No description. |