mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
Add unique names to most proposal regions
Also updates eslint rule to enforce regions with unique names
This commit is contained in:
parent
b79f09cd58
commit
c20b2c9589
|
@ -7,7 +7,7 @@ module.exports = new class ApiEventNaming {
|
|||
constructor() {
|
||||
this.meta = {
|
||||
messages: {
|
||||
comment: 'region comments should start with the GH issue link, e.g #region https://github.com/microsoft/vscode/issues/<number>',
|
||||
comment: 'region comments should start with a camel case identifier, `:`, then either a GH issue link or owner, e.g #region myProposalName: https://github.com/microsoft/vscode/issues/<number>',
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -15,14 +15,14 @@ module.exports = new class ApiEventNaming {
|
|||
const sourceCode = context.getSourceCode();
|
||||
return {
|
||||
['Program']: (_node) => {
|
||||
for (let comment of sourceCode.getAllComments()) {
|
||||
for (const comment of sourceCode.getAllComments()) {
|
||||
if (comment.type !== 'Line') {
|
||||
continue;
|
||||
}
|
||||
if (!comment.value.match(/^\s*#region /)) {
|
||||
if (!/^\s*#region /.test(comment.value)) {
|
||||
continue;
|
||||
}
|
||||
if (!comment.value.match(/https:\/\/github.com\/microsoft\/vscode\/issues\/\d+/i)) {
|
||||
if (!/^\s*#region ([a-z]+): (@[a-z]+|https:\/\/github.com\/microsoft\/vscode\/issues\/\d+)/i.test(comment.value)) {
|
||||
context.report({
|
||||
node: comment,
|
||||
messageId: 'comment',
|
||||
|
|
|
@ -9,7 +9,7 @@ export = new class ApiEventNaming implements eslint.Rule.RuleModule {
|
|||
|
||||
readonly meta: eslint.Rule.RuleMetaData = {
|
||||
messages: {
|
||||
comment: 'region comments should start with the GH issue link, e.g #region https://github.com/microsoft/vscode/issues/<number>',
|
||||
comment: 'region comments should start with a camel case identifier, `:`, then either a GH issue link or owner, e.g #region myProposalName: https://github.com/microsoft/vscode/issues/<number>',
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -17,18 +17,16 @@ export = new class ApiEventNaming implements eslint.Rule.RuleModule {
|
|||
|
||||
const sourceCode = context.getSourceCode();
|
||||
|
||||
|
||||
return {
|
||||
['Program']: (_node: any) => {
|
||||
|
||||
for (let comment of sourceCode.getAllComments()) {
|
||||
for (const comment of sourceCode.getAllComments()) {
|
||||
if (comment.type !== 'Line') {
|
||||
continue;
|
||||
}
|
||||
if (!comment.value.match(/^\s*#region /)) {
|
||||
if (!/^\s*#region /.test(comment.value)) {
|
||||
continue;
|
||||
}
|
||||
if (!comment.value.match(/https:\/\/github.com\/microsoft\/vscode\/issues\/\d+/i)) {
|
||||
if (!/^\s*#region ([a-z]+): (@[a-z]+|https:\/\/github.com\/microsoft\/vscode\/issues\/\d+)/i.test(comment.value)) {
|
||||
context.report({
|
||||
node: <any>comment,
|
||||
messageId: 'comment',
|
||||
|
|
91
src/vs/vscode.proposed.d.ts
vendored
91
src/vs/vscode.proposed.d.ts
vendored
|
@ -16,8 +16,7 @@
|
|||
|
||||
declare module 'vscode' {
|
||||
|
||||
// eslint-disable-next-line vscode-dts-region-comments
|
||||
//#region @alexdima - resolvers
|
||||
//#region resolvers: @alexdima
|
||||
|
||||
export interface MessageOptions {
|
||||
/**
|
||||
|
@ -268,7 +267,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region editor insets: https://github.com/microsoft/vscode/issues/85682
|
||||
//#region editorInsets: https://github.com/microsoft/vscode/issues/85682
|
||||
|
||||
export interface WebviewEditorInset {
|
||||
readonly editor: TextEditor;
|
||||
|
@ -285,7 +284,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region read/write in chunks: https://github.com/microsoft/vscode/issues/84515
|
||||
//#region fsChunks: https://github.com/microsoft/vscode/issues/84515
|
||||
|
||||
export interface FileSystemProvider {
|
||||
open?(resource: Uri, options: { create: boolean; }): number | Thenable<number>;
|
||||
|
@ -296,7 +295,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region TextSearchProvider: https://github.com/microsoft/vscode/issues/59921
|
||||
//#region textSearchProvider: https://github.com/microsoft/vscode/issues/59921
|
||||
|
||||
/**
|
||||
* The parameters of a query for text search.
|
||||
|
@ -553,7 +552,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region FileSearchProvider: https://github.com/microsoft/vscode/issues/73524
|
||||
//#region fileSearchProvider: https://github.com/microsoft/vscode/issues/73524
|
||||
|
||||
/**
|
||||
* The parameters of a query for file search.
|
||||
|
@ -719,7 +718,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region diff command: https://github.com/microsoft/vscode/issues/84899
|
||||
//#region diffCommand: https://github.com/microsoft/vscode/issues/84899
|
||||
|
||||
/**
|
||||
* The contiguous set of modified lines in a diff.
|
||||
|
@ -796,8 +795,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
// eslint-disable-next-line vscode-dts-region-comments
|
||||
//#region @joaomoreno: SCM validation
|
||||
// #region scmValidation: @joaomoreno:
|
||||
|
||||
/**
|
||||
* Represents the validation type of the Source Control input.
|
||||
|
@ -852,8 +850,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
// eslint-disable-next-line vscode-dts-region-comments
|
||||
//#region @joaomoreno: SCM selected provider
|
||||
//#region scmSelectedProvider: @joaomoreno:
|
||||
|
||||
export interface SourceControl {
|
||||
|
||||
|
@ -870,7 +867,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region Terminal data write event https://github.com/microsoft/vscode/issues/78502
|
||||
//#region terminalDataWriteEvent: https://github.com/microsoft/vscode/issues/78502
|
||||
|
||||
export interface TerminalDataWriteEvent {
|
||||
/**
|
||||
|
@ -894,7 +891,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region Terminal dimensions property and change event https://github.com/microsoft/vscode/issues/55718
|
||||
//#region terminalDimensions: https://github.com/microsoft/vscode/issues/55718
|
||||
|
||||
/**
|
||||
* An {@link Event} which fires when a {@link Terminal}'s dimensions change.
|
||||
|
@ -928,7 +925,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region Terminal location https://github.com/microsoft/vscode/issues/45407
|
||||
//#region terminalLocation: https://github.com/microsoft/vscode/issues/45407
|
||||
|
||||
export interface TerminalOptions {
|
||||
location?: TerminalLocation | TerminalEditorLocationOptions | TerminalSplitLocationOptions;
|
||||
|
@ -968,7 +965,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region Terminal name change event https://github.com/microsoft/vscode/issues/114898
|
||||
//#region terminalNameChangeEvent: https://github.com/microsoft/vscode/issues/114898
|
||||
|
||||
export interface Pseudoterminal {
|
||||
/**
|
||||
|
@ -992,8 +989,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
// eslint-disable-next-line vscode-dts-region-comments
|
||||
//#region @jrieken -> exclusive document filters
|
||||
//#region exclusiveDocumentFilters: @jrieken
|
||||
|
||||
export interface DocumentFilter {
|
||||
readonly exclusive?: boolean;
|
||||
|
@ -1001,13 +997,13 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region Tree View: https://github.com/microsoft/vscode/issues/61313 @alexr00
|
||||
//#region treeViewReveal: https://github.com/microsoft/vscode/issues/61313 @alexr00
|
||||
export interface TreeView<T> extends Disposable {
|
||||
reveal(element: T | undefined, options?: { select?: boolean, focus?: boolean, expand?: boolean | number; }): Thenable<void>;
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region Custom Tree View Drag and Drop https://github.com/microsoft/vscode/issues/32592
|
||||
//#region treeViewDragAndDrop: https://github.com/microsoft/vscode/issues/32592
|
||||
/**
|
||||
* A data provider that provides tree data
|
||||
*/
|
||||
|
@ -1071,7 +1067,7 @@ declare module 'vscode' {
|
|||
}
|
||||
//#endregion
|
||||
|
||||
//#region Task presentation group: https://github.com/microsoft/vscode/issues/47265
|
||||
//#region taskPresentationGroup: https://github.com/microsoft/vscode/issues/47265
|
||||
export interface TaskPresentationOptions {
|
||||
/**
|
||||
* Controls whether the task is executed in a specific terminal group using split panes.
|
||||
|
@ -1085,7 +1081,7 @@ declare module 'vscode' {
|
|||
}
|
||||
//#endregion
|
||||
|
||||
//#region Custom editor move https://github.com/microsoft/vscode/issues/86146
|
||||
//#region customEditorMove: https://github.com/microsoft/vscode/issues/86146
|
||||
|
||||
// TODO: Also for custom editor
|
||||
|
||||
|
@ -1109,7 +1105,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region allow QuickPicks to skip sorting: https://github.com/microsoft/vscode/issues/73904
|
||||
//#region quickPickSortByLabel: https://github.com/microsoft/vscode/issues/73904
|
||||
|
||||
export interface QuickPick<T extends QuickPickItem> extends QuickInput {
|
||||
/**
|
||||
|
@ -1120,7 +1116,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/124970, Cell Execution State
|
||||
//#region notebookCellExecutionState: https://github.com/microsoft/vscode/issues/124970
|
||||
|
||||
/**
|
||||
* The execution state of a notebook cell.
|
||||
|
@ -1167,7 +1163,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/106744, Notebook, deprecated & misc
|
||||
//#region notebookDeprecated: https://github.com/microsoft/vscode/issues/106744
|
||||
|
||||
export interface NotebookCellOutput {
|
||||
id: string;
|
||||
|
@ -1175,7 +1171,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/106744, NotebookEditor
|
||||
//#region notebookEditor: https://github.com/microsoft/vscode/issues/106744
|
||||
|
||||
/**
|
||||
* Represents a notebook editor that is attached to a {@link NotebookDocument notebook}.
|
||||
|
@ -1340,7 +1336,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/106744, NotebookEditorEdit
|
||||
//#region notebookEditorEdit: https://github.com/microsoft/vscode/issues/106744
|
||||
|
||||
// todo@API add NotebookEdit-type which handles all these cases?
|
||||
// export class NotebookEdit {
|
||||
|
@ -1388,7 +1384,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/106744, NotebookEditorDecorationType
|
||||
//#region notebookEditorDecorationType: https://github.com/microsoft/vscode/issues/106744
|
||||
|
||||
export interface NotebookEditor {
|
||||
setDecorations(decorationType: NotebookEditorDecorationType, range: NotebookRange): void;
|
||||
|
@ -1411,7 +1407,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/106744, NotebookConcatTextDocument
|
||||
//#region notebookConcatTextDocument: https://github.com/microsoft/vscode/issues/106744
|
||||
|
||||
export namespace notebooks {
|
||||
/**
|
||||
|
@ -1446,8 +1442,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/106744, NotebookContentProvider
|
||||
|
||||
//#region notebookContentProvider: https://github.com/microsoft/vscode/issues/106744
|
||||
|
||||
interface NotebookDocumentBackup {
|
||||
/**
|
||||
|
@ -1507,7 +1502,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/106744, LiveShare
|
||||
//#region notebookLiveShare: https://github.com/microsoft/vscode/issues/106744
|
||||
|
||||
export interface NotebookRegistrationData {
|
||||
displayName: string;
|
||||
|
@ -1524,7 +1519,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region @https://github.com/microsoft/vscode/issues/123601, notebook messaging
|
||||
//#region notebookMessaging: https://github.com/microsoft/vscode/issues/123601
|
||||
|
||||
/**
|
||||
* Represents a script that is loaded into the notebook renderer before rendering output. This allows
|
||||
|
@ -1591,7 +1586,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region @eamodio - timeline: https://github.com/microsoft/vscode/issues/84297
|
||||
//#region timeline: https://github.com/microsoft/vscode/issues/84297
|
||||
|
||||
export class TimelineItem {
|
||||
/**
|
||||
|
@ -1749,7 +1744,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/91555
|
||||
//#region tokenInformation: https://github.com/microsoft/vscode/issues/91555
|
||||
|
||||
export enum StandardTokenType {
|
||||
Other = 0,
|
||||
|
@ -1769,7 +1764,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/16221
|
||||
//#region inlayHints: https://github.com/microsoft/vscode/issues/16221
|
||||
|
||||
// todo@API Split between Inlay- and OverlayHints (InlayHint are for a position, OverlayHints for a non-empty range)
|
||||
// todo@API add "mini-markdown" for links and styles
|
||||
|
@ -1852,7 +1847,7 @@ declare module 'vscode' {
|
|||
}
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/104436
|
||||
//#region extensionRuntime: https://github.com/microsoft/vscode/issues/104436
|
||||
|
||||
export enum ExtensionRuntime {
|
||||
/**
|
||||
|
@ -1871,7 +1866,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/102091
|
||||
//#region textDocumentNotebook: https://github.com/microsoft/vscode/issues/102091
|
||||
|
||||
export interface TextDocument {
|
||||
|
||||
|
@ -1883,6 +1878,8 @@ declare module 'vscode' {
|
|||
}
|
||||
//#endregion
|
||||
|
||||
// TODO: @connor4312 split this up
|
||||
// eslint-disable-next-line vscode-dts-region-comments
|
||||
//#region proposed test APIs https://github.com/microsoft/vscode/issues/107467
|
||||
export namespace tests {
|
||||
/**
|
||||
|
@ -2079,7 +2076,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region Opener service (https://github.com/microsoft/vscode/issues/109277)
|
||||
//#region externalUriOpener: https://github.com/microsoft/vscode/issues/109277
|
||||
|
||||
/**
|
||||
* Details if an `ExternalUriOpener` can open a uri.
|
||||
|
@ -2237,7 +2234,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/Microsoft/vscode/issues/15178
|
||||
//#region tabs: https://github.com/Microsoft/vscode/issues/15178
|
||||
|
||||
/**
|
||||
* Represents a tab within the window
|
||||
|
@ -2332,7 +2329,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/120173
|
||||
//#region workspaceTrust: https://github.com/microsoft/vscode/issues/120173
|
||||
/**
|
||||
* The object describing the properties of the workspace trust request
|
||||
*/
|
||||
|
@ -2356,7 +2353,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/115616 @alexr00
|
||||
//#region portAttributesProvider: https://github.com/microsoft/vscode/issues/115616 @alexr00
|
||||
export enum PortAutoForwardAction {
|
||||
Notify = 1,
|
||||
OpenBrowser = 2,
|
||||
|
@ -2411,7 +2408,7 @@ declare module 'vscode' {
|
|||
}
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/119904 @eamodio
|
||||
//#region scmFocus: https://github.com/microsoft/vscode/issues/119904
|
||||
|
||||
export interface SourceControlInputBox {
|
||||
|
||||
|
@ -2423,7 +2420,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/124024 @hediet @alexdima
|
||||
//#region inlineCompletionProvider: https://github.com/microsoft/vscode/issues/124024 @hediet @alexdima
|
||||
|
||||
export namespace languages {
|
||||
/**
|
||||
|
@ -2545,7 +2542,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/126280 @mjbvz
|
||||
//#region notebookMime: https://github.com/microsoft/vscode/issues/126280 @mjbvz
|
||||
|
||||
export interface NotebookCellData {
|
||||
/**
|
||||
|
@ -2573,7 +2570,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/123713 @connor4312
|
||||
//#region testCoverage: https://github.com/microsoft/vscode/issues/123713 @connor4312
|
||||
export interface TestRun {
|
||||
/**
|
||||
* Test coverage provider for this result. An extension can defer setting
|
||||
|
@ -2764,7 +2761,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/129037
|
||||
//#region languageStatus: https://github.com/microsoft/vscode/issues/129037
|
||||
|
||||
enum LanguageStatusSeverity {
|
||||
Information = 0,
|
||||
|
@ -2791,7 +2788,7 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region @eamodio https://github.com/microsoft/vscode/issues/133935
|
||||
//#region scmActionButton: https://github.com/microsoft/vscode/issues/133935
|
||||
|
||||
export interface SourceControl {
|
||||
actionButton?: Command;
|
||||
|
|
Loading…
Reference in a new issue