Skip to content

Commit efb781e

Browse files
committed
Marking that documents/workspaces arrays cannot be mutated
1 parent 498deeb commit efb781e

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

extensions/css-language-features/client/src/customData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface ExperimentalConfig {
1313
};
1414
}
1515

16-
export function getCustomDataPathsInAllWorkspaces(workspaceFolders: WorkspaceFolder[] | undefined): string[] {
16+
export function getCustomDataPathsInAllWorkspaces(workspaceFolders: readonly WorkspaceFolder[] | undefined): string[] {
1717
const dataPaths: string[] = [];
1818

1919
if (!workspaceFolders) {

extensions/html-language-features/client/src/customData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface ExperimentalConfig {
1313
};
1414
}
1515

16-
export function getCustomDataPathsInAllWorkspaces(workspaceFolders: WorkspaceFolder[] | undefined): string[] {
16+
export function getCustomDataPathsInAllWorkspaces(workspaceFolders: readonly WorkspaceFolder[] | undefined): string[] {
1717
const dataPaths: string[] = [];
1818

1919
if (!workspaceFolders) {

extensions/typescript-language-features/src/typescriptServiceClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
634634
}
635635

636636
public getWorkspaceRootForResource(resource: vscode.Uri): string | undefined {
637-
const roots = vscode.workspace.workspaceFolders;
637+
const roots = vscode.workspace.workspaceFolders ? Array.from(vscode.workspace.workspaceFolders) : undefined;
638638
if (!roots || !roots.length) {
639639
return undefined;
640640
}

src/vs/vscode.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8435,7 +8435,7 @@ declare module 'vscode' {
84358435
* List of workspace folders or `undefined` when no folder is open.
84368436
* *Note* that the first entry corresponds to the value of `rootPath`.
84378437
*/
8438-
export const workspaceFolders: WorkspaceFolder[] | undefined;
8438+
export const workspaceFolders: ReadonlyArray<WorkspaceFolder> | undefined;
84398439

84408440
/**
84418441
* The name of the workspace. `undefined` when no folder
@@ -8609,7 +8609,7 @@ declare module 'vscode' {
86098609
/**
86108610
* All text documents currently known to the system.
86118611
*/
8612-
export const textDocuments: TextDocument[];
8612+
export const textDocuments: ReadonlyArray<TextDocument>;
86138613

86148614
/**
86158615
* Opens a document. Will return early if this document is already open. Otherwise

0 commit comments

Comments
 (0)