vscode-eslint 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/bin/vscode-eslint +82 -0
  2. package/client/out/client.d.ts +13 -0
  3. package/client/out/extension.d.ts +3 -0
  4. package/client/out/extension.js +2 -0
  5. package/client/out/extension.js.map +1 -0
  6. package/client/out/node-utils.d.ts +51 -0
  7. package/client/out/settings.d.ts +41 -0
  8. package/client/out/shared/customMessages.d.ts +89 -0
  9. package/client/out/shared/settings.d.ts +106 -0
  10. package/client/out/tasks.d.ts +31 -0
  11. package/client/out/tests/glob.test.d.ts +1 -0
  12. package/client/out/vscode-utils.d.ts +5 -0
  13. package/package.json +9 -2
  14. package/server/out/diff.d.ts +134 -0
  15. package/server/out/eslint.d.ts +298 -0
  16. package/server/out/eslintServer.d.ts +1 -0
  17. package/server/out/eslintServer.js +2 -0
  18. package/server/out/eslintServer.js.map +1 -0
  19. package/server/out/is.d.ts +3 -0
  20. package/server/out/languageDefaults.d.ts +6 -0
  21. package/server/out/linkedMap.d.ts +53 -0
  22. package/server/out/paths.d.ts +22 -0
  23. package/server/out/shared/customMessages.d.ts +89 -0
  24. package/server/out/shared/settings.d.ts +106 -0
  25. package/$shared/customMessages.ts +0 -113
  26. package/$shared/settings.ts +0 -189
  27. package/.CodeQL.yml +0 -5
  28. package/.azure-pipelines.yml +0 -27
  29. package/.gemini/agents/vscode-eslint.md +0 -23
  30. package/.github/commands.yml +0 -127
  31. package/.github/locker.yml +0 -6
  32. package/.github/needs_more_info.yml +0 -6
  33. package/.github/workflows/npm-publish.yml +0 -53
  34. package/.github/workflows/release-please.yml +0 -22
  35. package/.lsifrc.json +0 -4
  36. package/.vscode/launch.json +0 -20
  37. package/.vscode/settings.json +0 -52
  38. package/.vscode/spellright.dict +0 -8
  39. package/.vscode/tasks.json +0 -39
  40. package/.vscodeignore +0 -23
  41. package/CHANGELOG.md +0 -524
  42. package/SECURITY.md +0 -41
  43. package/agents.md +0 -36
  44. package/bin/vscode-eslint.js +0 -56
  45. package/build/azure-pipelines/linux/build.yml +0 -14
  46. package/build/azure-pipelines/pre-release.yml +0 -42
  47. package/build/azure-pipelines/release.yml +0 -45
  48. package/build/azure-pipelines/win32/build.yml +0 -14
  49. package/build/bin/all.js +0 -29
  50. package/build/bin/linking.js +0 -102
  51. package/build/bin/symlink.js +0 -35
  52. package/client/.mocharc.json +0 -6
  53. package/client/agents.md +0 -5
  54. package/client/package-lock.json +0 -176
  55. package/client/package.json +0 -29
  56. package/client/src/client.ts +0 -992
  57. package/client/src/extension.ts +0 -180
  58. package/client/src/node-utils.ts +0 -393
  59. package/client/src/settings.ts +0 -379
  60. package/client/src/tasks.ts +0 -186
  61. package/client/src/tests/glob.test.ts +0 -31
  62. package/client/src/vscode-utils.ts +0 -28
  63. package/client/test/mocha.opts +0 -3
  64. package/client/tsconfig.json +0 -20
  65. package/client/webpack.config.js +0 -25
  66. package/contributing.md +0 -19
  67. package/esbuild.js +0 -62
  68. package/eslint.config.js +0 -129
  69. package/history/settings_1_9_x.md +0 -110
  70. package/images/2_1_10/eslint-dialog.png +0 -0
  71. package/images/2_1_10/eslint-status.png +0 -0
  72. package/package-json-schema.json +0 -9
  73. package/playgrounds/7.0/.eslintignore +0 -1
  74. package/playgrounds/7.0/.eslintrc.json +0 -71
  75. package/playgrounds/7.0/.vscode/settings.json +0 -85
  76. package/playgrounds/7.0/app.js +0 -12
  77. package/playgrounds/7.0/build/.eslintignore +0 -1
  78. package/playgrounds/7.0/build/.eslintrc.json +0 -30
  79. package/playgrounds/7.0/build/build.js +0 -11
  80. package/playgrounds/7.0/jsconfig.json +0 -5
  81. package/playgrounds/7.0/package-lock.json +0 -2133
  82. package/playgrounds/7.0/package.json +0 -10
  83. package/playgrounds/7.0/readme.md +0 -0
  84. package/playgrounds/7.0/subDir/sub.js +0 -11
  85. package/playgrounds/7.0/subDir/test.jsx +0 -10
  86. package/playgrounds/7.0/test.js +0 -11
  87. package/playgrounds/7.0/test.sh +0 -1
  88. package/playgrounds/7.0/test.vue +0 -33
  89. package/playgrounds/7.0/test2.html +0 -8
  90. package/playgrounds/8.0/.eslintignore +0 -1
  91. package/playgrounds/8.0/.eslintrc.json +0 -71
  92. package/playgrounds/8.0/.vscode/settings.json +0 -91
  93. package/playgrounds/8.0/app.js +0 -12
  94. package/playgrounds/8.0/build/.eslintignore +0 -1
  95. package/playgrounds/8.0/build/.eslintrc.json +0 -30
  96. package/playgrounds/8.0/build/build.js +0 -11
  97. package/playgrounds/8.0/jsconfig.json +0 -5
  98. package/playgrounds/8.0/package-lock.json +0 -2321
  99. package/playgrounds/8.0/package.json +0 -10
  100. package/playgrounds/8.0/readme.md +0 -17
  101. package/playgrounds/8.0/subDir/sub.js +0 -11
  102. package/playgrounds/8.0/subDir/test.jsx +0 -10
  103. package/playgrounds/8.0/test.ipynb +0 -49
  104. package/playgrounds/8.0/test.js +0 -3
  105. package/playgrounds/8.0/test.sh +0 -1
  106. package/playgrounds/8.0/test.vue +0 -33
  107. package/playgrounds/8.0/test2.html +0 -8
  108. package/playgrounds/9.0/flat/.vscode/settings.json +0 -3
  109. package/playgrounds/9.0/flat/app.js +0 -12
  110. package/playgrounds/9.0/flat/dist/ignore.js +0 -12
  111. package/playgrounds/9.0/flat/eslint.config.js +0 -61
  112. package/playgrounds/9.0/flat/package-lock.json +0 -1053
  113. package/playgrounds/9.0/flat/package.json +0 -9
  114. package/playgrounds/9.0/rc/.eslintrc.json +0 -57
  115. package/playgrounds/9.0/rc/.vscode/settings.json +0 -3
  116. package/playgrounds/9.0/rc/app.js +0 -12
  117. package/playgrounds/9.0/rc/package-lock.json +0 -1345
  118. package/playgrounds/9.0/rc/package.json +0 -9
  119. package/playgrounds/flat-config/.vscode/settings.json +0 -22
  120. package/playgrounds/flat-config/app.js +0 -12
  121. package/playgrounds/flat-config/eslint.config.js +0 -51
  122. package/playgrounds/flat-config/package-lock.json +0 -2733
  123. package/playgrounds/flat-config/package.json +0 -12
  124. package/playgrounds/flat-config/sub/sub.js +0 -2
  125. package/playgrounds/flat-config/test.ts +0 -7
  126. package/playgrounds/flat-config/tsconfig.json +0 -11
  127. package/playgrounds/flat-config-fail/f1/app.js +0 -12
  128. package/playgrounds/flat-config-fail/f1/eslint.config.js +0 -51
  129. package/playgrounds/flat-config-fail/package-lock.json +0 -1683
  130. package/playgrounds/flat-config-fail/package.json +0 -11
  131. package/playgrounds/flat-config-mjs/.vscode/settings.json +0 -21
  132. package/playgrounds/flat-config-mjs/app.js +0 -12
  133. package/playgrounds/flat-config-mjs/eslint.config.mjs +0 -53
  134. package/playgrounds/flat-config-mjs/package-lock.json +0 -2860
  135. package/playgrounds/flat-config-mjs/package.json +0 -11
  136. package/playgrounds/flat-config-mjs/sub/sub.js +0 -2
  137. package/playgrounds/flat-config-mjs/test.ts +0 -7
  138. package/playgrounds/flat-config-mjs/tsconfig.json +0 -11
  139. package/playgrounds/load-eslint/.vscode/settings.json +0 -21
  140. package/playgrounds/load-eslint/app.js +0 -12
  141. package/playgrounds/load-eslint/eslint.config.js +0 -51
  142. package/playgrounds/load-eslint/package-lock.json +0 -2860
  143. package/playgrounds/load-eslint/package.json +0 -11
  144. package/playgrounds/load-eslint/sub/sub.js +0 -2
  145. package/playgrounds/load-eslint/test.ts +0 -7
  146. package/playgrounds/load-eslint/tsconfig.json +0 -11
  147. package/playgrounds/noLib/test.js +0 -22
  148. package/playgrounds/noWD/.vscode/settings.json +0 -2
  149. package/playgrounds/noWD/src/.eslintrc.json +0 -18
  150. package/playgrounds/noWD/src/package-lock.json +0 -2812
  151. package/playgrounds/noWD/src/package.json +0 -12
  152. package/playgrounds/noWD/src/test.js +0 -3
  153. package/playgrounds/notebooks/notebook.ipynb +0 -7072
  154. package/playgrounds/notebooks/notebook2.ipynb +0 -20
  155. package/playgrounds/testing.code-workspace +0 -28
  156. package/playgrounds/ts/.eslintrc.base.json +0 -23
  157. package/playgrounds/ts/.eslintrc.json +0 -191
  158. package/playgrounds/ts/.vscode/settings.json +0 -12
  159. package/playgrounds/ts/package-lock.json +0 -2687
  160. package/playgrounds/ts/package.json +0 -11
  161. package/playgrounds/ts/test copy.ts +0 -4
  162. package/playgrounds/ts/test.ipynb +0 -49
  163. package/playgrounds/ts/test.ts +0 -4
  164. package/playgrounds/ts/test.tsx +0 -14
  165. package/playgrounds/ts/tsconfig.json +0 -100
  166. package/server/agents.md +0 -9
  167. package/server/package-lock.json +0 -93
  168. package/server/package.json +0 -32
  169. package/server/src/diff.ts +0 -1079
  170. package/server/src/eslint.ts +0 -1471
  171. package/server/src/eslintServer.ts +0 -865
  172. package/server/src/is.ts +0 -18
  173. package/server/src/languageDefaults.ts +0 -40
  174. package/server/src/linkedMap.ts +0 -448
  175. package/server/src/paths.ts +0 -128
  176. package/server/src/thenable.d.ts +0 -5
  177. package/server/tsconfig.json +0 -21
  178. package/server/webpack.config.js +0 -25
  179. package/shared.webpack.config.js +0 -59
  180. package/tsconfig.base.json +0 -9
  181. package/tsconfig.json +0 -21
@@ -0,0 +1,51 @@
1
+ export declare namespace Is {
2
+ function boolean(value: any): value is boolean;
3
+ function string(value: any): value is string;
4
+ function objectLiteral(value: any): value is object;
5
+ }
6
+ /**
7
+ * Converts a path to the OS representation,
8
+ * @param path the path to convert.
9
+ * @returns the converted path.
10
+ */
11
+ export declare function toOSPath(path: string): string;
12
+ /**
13
+ * Converts a path to a posix path.
14
+ * @param path the path to convert.
15
+ * @returns the posix path.
16
+ */
17
+ export declare function toPosixPath(path: string): string;
18
+ /**
19
+ * Find a ESLint installation at a given root path.
20
+ * @param rootPath the root path.
21
+ * @returns the eslint installation or the unresolved command eslint.
22
+ */
23
+ export declare function findEslint(rootPath: string): Promise<string>;
24
+ /**
25
+ * Converts a pattern in string from to a regular expression.
26
+ *
27
+ * @param pattern the pattern as a string to be converted
28
+ * @returns the regular expression or undefined if the pattern can't be converted.
29
+ */
30
+ export declare function convert2RegExp(pattern: string): RegExp | undefined;
31
+ /**
32
+ * A semaphore implementation.
33
+ */
34
+ export declare class Semaphore<T = void> {
35
+ private _capacity;
36
+ private _active;
37
+ private _waiting;
38
+ constructor(capacity?: number);
39
+ /**
40
+ * Takes a lock and executes the thunk.
41
+ * @param thunk the thunk to execute
42
+ * @returns a promise for the result of the thunk
43
+ */
44
+ lock(thunk: () => T | PromiseLike<T>): Promise<T>;
45
+ /**
46
+ * Returns the numbers of the active thunks.
47
+ */
48
+ get active(): number;
49
+ private runNext;
50
+ private doRunNext;
51
+ }
@@ -0,0 +1,41 @@
1
+ import { Uri } from 'vscode';
2
+ export type ValidateItem = {
3
+ language: string;
4
+ autoFix?: boolean;
5
+ };
6
+ export declare namespace ValidateItem {
7
+ function is(item: any): item is ValidateItem;
8
+ }
9
+ export type LegacyDirectoryItem = {
10
+ directory: string;
11
+ changeProcessCWD: boolean;
12
+ };
13
+ export declare namespace LegacyDirectoryItem {
14
+ function is(item: any): item is LegacyDirectoryItem;
15
+ }
16
+ export type PatternItem = {
17
+ pattern: string;
18
+ '!cwd'?: boolean;
19
+ };
20
+ export declare namespace PatternItem {
21
+ function is(item: any): item is PatternItem;
22
+ }
23
+ export declare class Migration {
24
+ private workspaceConfig;
25
+ private eslintConfig;
26
+ private editorConfig;
27
+ private codeActionOnSave;
28
+ private languageSpecificSettings;
29
+ private autoFixOnSave;
30
+ private validate;
31
+ private workingDirectories;
32
+ private didChangeConfiguration;
33
+ constructor(resource: Uri);
34
+ record(): void;
35
+ captureDidChangeSetting(func: () => void): void;
36
+ private recordAutoFixOnSave;
37
+ private recordValidate;
38
+ private recordWorkingDirectories;
39
+ needsUpdate(): boolean;
40
+ update(): Promise<void>;
41
+ }
@@ -0,0 +1,89 @@
1
+ import { NotificationType, NotificationType0, RequestType, TextDocumentIdentifier } from 'vscode-languageserver-protocol';
2
+ export declare enum Status {
3
+ ok = 1,
4
+ warn = 2,
5
+ error = 3
6
+ }
7
+ export type StatusParams = {
8
+ uri: string;
9
+ state: Status;
10
+ validationTime?: number;
11
+ };
12
+ /**
13
+ * The status notification is sent from the server to the client to
14
+ * inform the client about server status changes.
15
+ */
16
+ export declare namespace StatusNotification {
17
+ const method: 'eslint/status';
18
+ const type: NotificationType<StatusParams>;
19
+ }
20
+ export type NoConfigParams = {
21
+ message: string;
22
+ document: TextDocumentIdentifier;
23
+ };
24
+ export type NoConfigResult = {};
25
+ /**
26
+ * The NoConfigRequest is sent from the server to the client to inform
27
+ * the client that no eslint configuration file could be found when
28
+ * trying to lint a file.
29
+ */
30
+ export declare namespace NoConfigRequest {
31
+ const method: 'eslint/noConfig';
32
+ const type: RequestType<NoConfigParams, NoConfigResult, void>;
33
+ }
34
+ export type NoESLintLibraryParams = {
35
+ source: TextDocumentIdentifier;
36
+ };
37
+ export type NoESLintLibraryResult = {};
38
+ /**
39
+ * The NoESLintLibraryRequest is sent from the server to the client to
40
+ * inform the client that no eslint library could be found when trying
41
+ * to lint a file.
42
+ */
43
+ export declare namespace NoESLintLibraryRequest {
44
+ const method: 'eslint/noLibrary';
45
+ const type: RequestType<NoESLintLibraryParams, NoESLintLibraryResult, void>;
46
+ }
47
+ export type OpenESLintDocParams = {
48
+ url: string;
49
+ };
50
+ export type OpenESLintDocResult = {};
51
+ /**
52
+ * The eslint/openDoc request is sent from the server to the client to
53
+ * ask the client to open the documentation URI for a given
54
+ * ESLint rule.
55
+ */
56
+ export declare namespace OpenESLintDocRequest {
57
+ const method: 'eslint/openDoc';
58
+ const type: RequestType<OpenESLintDocParams, OpenESLintDocResult, void>;
59
+ }
60
+ export type ProbeFailedParams = {
61
+ textDocument: TextDocumentIdentifier;
62
+ };
63
+ /**
64
+ * The eslint/probeFailed request is sent from the server to the client
65
+ * to tell the client the the lint probing for a certain document has
66
+ * failed and that there is no need to sync that document to the server
67
+ * anymore.
68
+ */
69
+ export declare namespace ProbeFailedRequest {
70
+ const method: 'eslint/probeFailed';
71
+ const type: RequestType<ProbeFailedParams, void, void>;
72
+ }
73
+ /**
74
+ * The eslint/showOutputChannel notification is sent from the server to
75
+ * the client to ask the client to reveal it's output channel.
76
+ */
77
+ export declare namespace ShowOutputChannel {
78
+ const method: 'eslint/showOutputChannel';
79
+ const type: NotificationType0;
80
+ }
81
+ /**
82
+ * The eslint/exitCalled notification is sent from the server to the client
83
+ * to inform the client that a process.exit call on the server got intercepted.
84
+ * The call was very likely made by an ESLint plugin.
85
+ */
86
+ export declare namespace ExitCalled {
87
+ const method: 'eslint/exitCalled';
88
+ const type: NotificationType<[number, string]>;
89
+ }
@@ -0,0 +1,106 @@
1
+ import { WorkspaceFolder } from 'vscode-languageserver-protocol';
2
+ export declare enum Validate {
3
+ on = "on",
4
+ off = "off",
5
+ probe = "probe"
6
+ }
7
+ export type CodeActionSettings = {
8
+ disableRuleComment: {
9
+ enable: boolean;
10
+ location: 'separateLine' | 'sameLine';
11
+ commentStyle: 'line' | 'block';
12
+ };
13
+ showDocumentation: {
14
+ enable: boolean;
15
+ };
16
+ };
17
+ export declare enum CodeActionsOnSaveMode {
18
+ all = "all",
19
+ problems = "problems"
20
+ }
21
+ export declare namespace CodeActionsOnSaveMode {
22
+ function from(value: string | undefined | null): CodeActionsOnSaveMode;
23
+ }
24
+ export declare namespace CodeActionsOnSaveRules {
25
+ function from(value: string[] | undefined | null): string[] | undefined;
26
+ }
27
+ export declare namespace CodeActionsOnSaveOptions {
28
+ function from(value: object | undefined | null): ESLintOptions | undefined;
29
+ }
30
+ export type CodeActionsOnSaveSettings = {
31
+ mode: CodeActionsOnSaveMode;
32
+ rules?: string[];
33
+ options?: ESLintOptions;
34
+ };
35
+ export declare enum ESLintSeverity {
36
+ off = "off",
37
+ warn = "warn",
38
+ error = "error"
39
+ }
40
+ export declare namespace ESLintSeverity {
41
+ function from(value: string | undefined | null): ESLintSeverity;
42
+ }
43
+ export declare enum RuleSeverity {
44
+ info = "info",
45
+ warn = "warn",
46
+ error = "error",
47
+ off = "off",
48
+ default = "default",
49
+ downgrade = "downgrade",
50
+ upgrade = "upgrade"
51
+ }
52
+ export type RuleCustomization = {
53
+ rule: string;
54
+ severity: RuleSeverity;
55
+ /** Only apply to autofixable rules */
56
+ fixable?: boolean;
57
+ };
58
+ export type RunValues = 'onType' | 'onSave';
59
+ export declare enum ModeEnum {
60
+ auto = "auto",
61
+ location = "location"
62
+ }
63
+ export declare namespace ModeEnum {
64
+ function is(value: string): value is ModeEnum;
65
+ }
66
+ export type ModeItem = {
67
+ mode: ModeEnum;
68
+ };
69
+ export declare namespace ModeItem {
70
+ function is(item: any): item is ModeItem;
71
+ }
72
+ export type DirectoryItem = {
73
+ directory: string;
74
+ '!cwd'?: boolean;
75
+ };
76
+ export declare namespace DirectoryItem {
77
+ function is(item: any): item is DirectoryItem;
78
+ }
79
+ export type PackageManagers = 'npm' | 'yarn' | 'pnpm';
80
+ export type ESLintOptions = object & {
81
+ fixTypes?: string[];
82
+ };
83
+ export type ConfigurationSettings = {
84
+ validate: Validate;
85
+ packageManager: PackageManagers;
86
+ useESLintClass: boolean;
87
+ useFlatConfig?: boolean | undefined;
88
+ useRealpaths: boolean;
89
+ experimental?: {
90
+ useFlatConfig: boolean;
91
+ };
92
+ codeAction: CodeActionSettings;
93
+ codeActionOnSave: CodeActionsOnSaveSettings;
94
+ format: boolean;
95
+ quiet: boolean;
96
+ onIgnoredFiles: ESLintSeverity;
97
+ options: ESLintOptions | undefined;
98
+ rulesCustomizations: RuleCustomization[];
99
+ run: RunValues;
100
+ problems: {
101
+ shortenToSingleLine: boolean;
102
+ };
103
+ nodePath: string | null;
104
+ workspaceFolder: WorkspaceFolder | undefined;
105
+ workingDirectory: ModeItem | DirectoryItem | undefined;
106
+ };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * A task provider that adds ESLint checking tasks.
3
+ */
4
+ export declare class TaskProvider {
5
+ /**
6
+ * A Disposable to unregister the task provider inside
7
+ * VS Code.
8
+ */
9
+ private taskProvider;
10
+ /**
11
+ * The actual providers per workspace folder.
12
+ */
13
+ private readonly providers;
14
+ /**
15
+ * A disposable to unregister event listeners
16
+ */
17
+ private disposable;
18
+ constructor();
19
+ start(): void;
20
+ dispose(): void;
21
+ /**
22
+ * The workspace folders have changed.
23
+ */
24
+ private updateWorkspaceFolders;
25
+ /**
26
+ * The configuration has changed.
27
+ */
28
+ private updateConfiguration;
29
+ private updateProvider;
30
+ private getTasks;
31
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { WorkspaceFolder } from 'vscode';
2
+ /**
3
+ * Picks a folder from a list of workspace folders.
4
+ */
5
+ export declare function pickFolder(folders: ReadonlyArray<WorkspaceFolder>, placeHolder: string): Promise<WorkspaceFolder | undefined>;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "vscode-eslint",
3
3
  "displayName": "ESLint",
4
4
  "description": "Integrates ESLint JavaScript into VS Code.",
5
- "version": "0.0.2",
5
+ "version": "0.0.4",
6
6
  "author": "Microsoft Corporation",
7
7
  "license": "MIT",
8
8
  "repository": {
@@ -14,8 +14,15 @@
14
14
  },
15
15
  "publisher": "dbaeumer",
16
16
  "bin": {
17
- "vscode-eslint": "bin/vscode-eslint.js"
17
+ "vscode-eslint": "bin/vscode-eslint"
18
18
  },
19
+ "files": [
20
+ "bin",
21
+ "client/out",
22
+ "server/out",
23
+ "shared",
24
+ "eslint_icon.png"
25
+ ],
19
26
  "icon": "eslint_icon.png",
20
27
  "categories": [
21
28
  "Programming Languages",
@@ -0,0 +1,134 @@
1
+ export interface IDiffChange {
2
+ /**
3
+ * The position of the first element in the original sequence which
4
+ * this change affects.
5
+ */
6
+ originalStart: number;
7
+ /**
8
+ * The number of elements from the original sequence which were
9
+ * affected.
10
+ */
11
+ originalLength: number;
12
+ /**
13
+ * The position of the first element in the modified sequence which
14
+ * this change affects.
15
+ */
16
+ modifiedStart: number;
17
+ /**
18
+ * The number of elements from the modified sequence which were
19
+ * affected (added).
20
+ */
21
+ modifiedLength: number;
22
+ }
23
+ export declare function stringDiff(original: string, modified: string, pretty: boolean): IDiffChange[];
24
+ interface ISequence {
25
+ getElements(): Int32Array;
26
+ }
27
+ interface IContinueProcessingPredicate {
28
+ (furthestOriginalIndex: number, matchLengthOfLongest: number): boolean;
29
+ }
30
+ interface IDiffResult {
31
+ quitEarly: boolean;
32
+ changes: IDiffChange[];
33
+ }
34
+ export declare class Debug {
35
+ static Assert(condition: boolean, message: string): void;
36
+ }
37
+ /**
38
+ * An implementation of the difference algorithm described in
39
+ * "An O(ND) Difference Algorithm and its variations" by Eugene W. Myers
40
+ */
41
+ export declare class LcsDiff {
42
+ private readonly ContinueProcessingPredicate;
43
+ private readonly _hasStrings;
44
+ private readonly _originalStringElements;
45
+ private readonly _originalElementsOrHash;
46
+ private readonly _modifiedStringElements;
47
+ private readonly _modifiedElementsOrHash;
48
+ private m_forwardHistory;
49
+ private m_reverseHistory;
50
+ /**
51
+ * Constructs the DiffFinder
52
+ */
53
+ constructor(originalSequence: ISequence, modifiedSequence: ISequence, continueProcessingPredicate?: IContinueProcessingPredicate | null);
54
+ private static _getElements;
55
+ private ElementsAreEqual;
56
+ private OriginalElementsAreEqual;
57
+ private ModifiedElementsAreEqual;
58
+ ComputeDiff(pretty: boolean): IDiffResult;
59
+ /**
60
+ * Computes the differences between the original and modified input
61
+ * sequences on the bounded range.
62
+ * @returns An array of the differences between the two input sequences.
63
+ */
64
+ private _ComputeDiff;
65
+ /**
66
+ * Private helper method which computes the differences on the bounded range
67
+ * recursively.
68
+ * @returns An array of the differences between the two input sequences.
69
+ */
70
+ private ComputeDiffRecursive;
71
+ private WALKTRACE;
72
+ /**
73
+ * Given the range to compute the diff on, this method finds the point:
74
+ * (midOriginal, midModified)
75
+ * that exists in the middle of the LCS of the two sequences and
76
+ * is the point at which the LCS problem may be broken down recursively.
77
+ * This method will try to keep the LCS trace in memory. If the LCS recursion
78
+ * point is calculated and the full trace is available in memory, then this method
79
+ * will return the change list.
80
+ * @param originalStart The start bound of the original sequence range
81
+ * @param originalEnd The end bound of the original sequence range
82
+ * @param modifiedStart The start bound of the modified sequence range
83
+ * @param modifiedEnd The end bound of the modified sequence range
84
+ * @param midOriginal The middle point of the original sequence range
85
+ * @param midModified The middle point of the modified sequence range
86
+ * @returns The diff changes, if available, otherwise null
87
+ */
88
+ private ComputeRecursionPoint;
89
+ /**
90
+ * Shifts the given changes to provide a more intuitive diff.
91
+ * While the first element in a diff matches the first element after the diff,
92
+ * we shift the diff down.
93
+ *
94
+ * @param changes The list of changes to shift
95
+ * @returns The shifted changes
96
+ */
97
+ private PrettifyChanges;
98
+ private _OriginalIsBoundary;
99
+ private _OriginalRegionIsBoundary;
100
+ private _ModifiedIsBoundary;
101
+ private _ModifiedRegionIsBoundary;
102
+ private _boundaryScore;
103
+ /**
104
+ * Concatenates the two input DiffChange lists and returns the resulting
105
+ * list.
106
+ * @param The left changes
107
+ * @param The right changes
108
+ * @returns The concatenated list
109
+ */
110
+ private ConcatenateChanges;
111
+ /**
112
+ * Returns true if the two changes overlap and can be merged into a single
113
+ * change
114
+ * @param left The left change
115
+ * @param right The right change
116
+ * @param mergedChange The merged change if the two overlap, null otherwise
117
+ * @returns True if the two changes overlap
118
+ */
119
+ private ChangesOverlap;
120
+ /**
121
+ * Helper method used to clip a diagonal index to the range of valid
122
+ * diagonals. This also decides whether or not the diagonal index,
123
+ * if it exceeds the boundary, should be clipped to the boundary or clipped
124
+ * one inside the boundary depending on the Even/Odd status of the boundary
125
+ * and numDifferences.
126
+ * @param diagonal The index of the diagonal to clip.
127
+ * @param numDifferences The current number of differences being iterated upon.
128
+ * @param diagonalBaseIndex The base reference diagonal.
129
+ * @param numDiagonals The total number of diagonals.
130
+ * @returns The clipped diagonal index.
131
+ */
132
+ private ClipDiagonalBound;
133
+ }
134
+ export {};