@adecore/editor-core 0.53.2 → 0.54.0
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.
- package/dist/comments.js +1 -1
- package/dist/document.d.ts +4 -4
- package/dist/document.js +18 -18
- package/dist/edit-source.d.ts +1 -1
- package/dist/lexical-folds.d.ts +1 -1
- package/dist/line-commands.js +1 -1
- package/dist/search.js +1 -1
- package/dist/text-span.js +1 -6
- package/package.json +4 -1
- package/src/comments.ts +2 -2
- package/src/document.ts +22 -22
- package/src/edit-source.ts +1 -1
- package/src/enter.ts +1 -1
- package/src/lexical-folds.ts +1 -1
- package/src/line-commands.ts +1 -1
- package/src/search.ts +1 -1
- package/src/statements.ts +1 -1
- package/src/text-places.ts +1 -1
- package/src/text-span.ts +2 -8
package/dist/comments.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { editRegions, phpLiteralAt, phpTagAt } from './edit-regions.js';
|
|
2
|
-
import { hasJsx } from './markup-regions.js';
|
|
3
2
|
import { commentSyntax } from './languages.js';
|
|
4
3
|
import { indentText, isBlank, rangeOf, whitespaceOf } from './line-text.js';
|
|
4
|
+
import { hasJsx } from './markup-regions.js';
|
|
5
5
|
import { mapOffset } from './offsets.js';
|
|
6
6
|
import { indentationColumn } from './structure.js';
|
|
7
7
|
function syntaxOf(regions, options, line, offset) {
|
package/dist/document.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { BracketMatch } from './brackets.ts';
|
|
2
|
+
import { type PostfixOperand } from './postfix-operands.ts';
|
|
2
3
|
import type { DocumentLine } from './rope.ts';
|
|
3
4
|
import type { FindMatch, FindNextOptions, FindOptions } from './search.ts';
|
|
4
5
|
import type { FoldingOptions, FoldingRange } from './structure.ts';
|
|
5
|
-
import type { CommandOptions, Disposable, EditOptions, EditorCommand, EditorSnapshot, Position, Selection, TextEdit } from './types.ts';
|
|
6
|
-
import { type TextPlace } from './text-places.ts';
|
|
7
|
-
import { type PostfixOperand } from './postfix-operands.ts';
|
|
8
6
|
import { type SurroundShape } from './surround-shape.ts';
|
|
9
|
-
import { type
|
|
7
|
+
import { type TextPlace } from './text-places.ts';
|
|
10
8
|
import { type TodoMatch, type TodoOptions } from './todo.ts';
|
|
9
|
+
import type { CommandOptions, Disposable, EditOptions, EditorCommand, EditorSnapshot, Position, Selection, TextEdit } from './types.ts';
|
|
10
|
+
import { type UnwrapTarget } from './unwrap.ts';
|
|
11
11
|
import { type WhitespaceCleanupOptions } from './whitespace-cleanup.ts';
|
|
12
12
|
export type { DocumentLine, FindMatch, FindNextOptions, FindOptions, FoldingOptions, FoldingRange };
|
|
13
13
|
export interface OffsetRange {
|
package/dist/document.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { blockFolds } from './block-folds.js';
|
|
2
|
+
import { BracketTracker } from './bracket-tracker.js';
|
|
3
|
+
import { scanBrackets } from './brackets.js';
|
|
2
4
|
import { CloserTracker } from './closer-tracker.js';
|
|
3
|
-
import { planBlockComment, planLineComments } from './comments.js';
|
|
4
|
-
import { planEnter } from './enter.js';
|
|
5
5
|
import { planCodeBlock } from './code-blocks.js';
|
|
6
|
+
import { planBlockComment, planLineComments } from './comments.js';
|
|
6
7
|
import { planCompleteStatement } from './complete-statement.js';
|
|
7
|
-
import {
|
|
8
|
+
import { planEnter } from './enter.js';
|
|
9
|
+
import { applyFoldHints, markFileHeader } from './fold-roles.js';
|
|
8
10
|
import { planHippie } from './hippie.js';
|
|
9
|
-
import { planAutoIndent, planJoinLines, planToggleCase, properIndent, spacingBetween } from './line-commands.js';
|
|
10
|
-
import { mapOffset, offsetMapper } from './offsets.js';
|
|
11
|
-
import { planPaste } from './paste.js';
|
|
12
11
|
import { isPlainText, vueRegionAt } from './languages.js';
|
|
13
|
-
import { blockFolds } from './block-folds.js';
|
|
14
|
-
import { applyFoldHints, markFileHeader } from './fold-roles.js';
|
|
15
12
|
import { lexicalFolds } from './lexical-folds.js';
|
|
16
|
-
import { rangeOf, whitespaceOf } from './line-text.js';
|
|
17
|
-
import { isQuote, replacesComparison, surround, swapQuotes, templateLiteralEdits, templateString } from './typing-handlers.js';
|
|
18
|
-
import { scanBrackets } from './brackets.js';
|
|
19
|
-
import { BracketTracker } from './bracket-tracker.js';
|
|
20
13
|
import { hasSmartSemicolon, isPhp } from './lexical.js';
|
|
14
|
+
import { planAutoIndent, planJoinLines, planToggleCase, properIndent, spacingBetween } from './line-commands.js';
|
|
15
|
+
import { planConvertIndents, planLineOrder } from './line-order.js';
|
|
16
|
+
import { rangeOf, whitespaceOf } from './line-text.js';
|
|
17
|
+
import { mapOffset, offsetMapper } from './offsets.js';
|
|
18
|
+
import { planPaste } from './paste.js';
|
|
19
|
+
import { postfixOperands } from './postfix-operands.js';
|
|
21
20
|
import { clampInteger, TextRope, ROPE_CHUNK_SIZE } from './rope.js';
|
|
21
|
+
import { scriptSource } from './script-source.js';
|
|
22
22
|
import { findMatches, findMatchFrom, replacementText, splitsSurrogate } from './search.js';
|
|
23
|
+
import { planMoveStatement, statementMoveMode } from './statement-move.js';
|
|
23
24
|
import { dedupeFoldingRanges, deriveFoldingRanges, indentationColumn, scanStructure, tabWidth } from './structure.js';
|
|
24
|
-
import { TypingContexts } from './typing-context.js';
|
|
25
|
-
import { placeAt } from './text-places.js';
|
|
26
|
-
import { postfixOperands } from './postfix-operands.js';
|
|
27
25
|
import { surroundShape } from './surround-shape.js';
|
|
28
|
-
import {
|
|
26
|
+
import { placeAt } from './text-places.js';
|
|
29
27
|
import { todosInLines } from './todo.js';
|
|
30
|
-
import {
|
|
28
|
+
import { TypingContexts } from './typing-context.js';
|
|
29
|
+
import { isQuote, replacesComparison, surround, swapQuotes, templateLiteralEdits, templateString } from './typing-handlers.js';
|
|
30
|
+
import { unwrapTargets } from './unwrap.js';
|
|
31
31
|
import { ModifiedStretches, planWhitespaceCleanup } from './whitespace-cleanup.js';
|
|
32
32
|
import { isHumpBoundary, isWordBoundary } from './words.js';
|
|
33
33
|
const LINE_ORDERS = { sortLines: 'sort', reverseLines: 'reverse', uniqueLines: 'unique' };
|
package/dist/edit-source.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { VueRegion } from './languages.ts';
|
|
2
2
|
import type { DocumentLine } from './rope.ts';
|
|
3
|
-
import type { TypingContext } from './typing-context.ts';
|
|
4
3
|
import type { Selection, TextEdit } from './types.ts';
|
|
4
|
+
import type { TypingContext } from './typing-context.ts';
|
|
5
5
|
export interface EditSource {
|
|
6
6
|
slice(from: number, to: number): string;
|
|
7
7
|
charAt(offset: number): string;
|
package/dist/lexical-folds.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FoldRole, FoldingRange } from './structure.ts';
|
|
2
1
|
import type { DocumentLine } from './rope.ts';
|
|
2
|
+
import type { FoldRole, FoldingRange } from './structure.ts';
|
|
3
3
|
export declare function isImportLine(language: string, trimmed: string): boolean;
|
|
4
4
|
export interface LexicalFoldOptions {
|
|
5
5
|
imports?: boolean;
|
package/dist/line-commands.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { commentSyntax } from './languages.js';
|
|
2
1
|
import { caseLabel, lineContinues } from './enter.js';
|
|
2
|
+
import { commentSyntax } from './languages.js';
|
|
3
3
|
import { indentsByBrackets } from './lexical.js';
|
|
4
4
|
import { isBlank, rangeOf, whitespaceOf } from './line-text.js';
|
|
5
5
|
import { markupGuard } from './markup-regions.js';
|
package/dist/search.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { clampInteger } from './rope.js';
|
|
2
1
|
import { replaceWithCaseRespect } from './preserve-case.js';
|
|
2
|
+
import { clampInteger } from './rope.js';
|
|
3
3
|
const wordCharacter = /[\p{L}\p{N}\p{M}\p{Pc}$]/u;
|
|
4
4
|
/* Whether `offset` sits between the two halves of a surrogate pair. */
|
|
5
5
|
export function splitsSurrogate(text, offset) {
|
package/dist/text-span.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
return code >= 0xd800 && code <= 0xdbff;
|
|
3
|
-
}
|
|
4
|
-
function isLowSurrogate(code) {
|
|
5
|
-
return code >= 0xdc00 && code <= 0xdfff;
|
|
6
|
-
}
|
|
1
|
+
import { isHighSurrogate, isLowSurrogate } from '@adecore/utils/text';
|
|
7
2
|
/*
|
|
8
3
|
* The one stretch that differs between two texts, found from both ends. Replacing only that keeps a
|
|
9
4
|
* cursor, a selection and the scroll where they were anywhere outside it, which setting the whole
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adecore/editor-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.54.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
"build": "bun scripts/build.ts",
|
|
16
16
|
"test": "bun test --conditions=source"
|
|
17
17
|
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@adecore/utils": "0.54.0"
|
|
20
|
+
},
|
|
18
21
|
"devDependencies": {
|
|
19
22
|
"@types/bun": "^1.4.4",
|
|
20
23
|
"typescript": "^7.0.2"
|
package/src/comments.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { EditPlan, EditSource } from './edit-source.ts';
|
|
2
1
|
import { editRegions, phpLiteralAt, phpTagAt, type EditRegions } from './edit-regions.ts';
|
|
3
|
-
import {
|
|
2
|
+
import type { EditPlan, EditSource } from './edit-source.ts';
|
|
4
3
|
import { type BlockComment, type CommentSyntax, commentSyntax } from './languages.ts';
|
|
5
4
|
import { indentText, isBlank, rangeOf, whitespaceOf } from './line-text.ts';
|
|
5
|
+
import { hasJsx } from './markup-regions.ts';
|
|
6
6
|
import { mapOffset } from './offsets.ts';
|
|
7
7
|
import { indentationColumn } from './structure.ts';
|
|
8
8
|
import type { Selection, TextEdit } from './types.ts';
|
package/src/document.ts
CHANGED
|
@@ -1,32 +1,36 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { blockFolds } from './block-folds.ts';
|
|
2
|
+
import { BracketTracker } from './bracket-tracker.ts';
|
|
3
|
+
import { scanBrackets } from './brackets.ts';
|
|
4
|
+
import type { BracketIndex, BracketMatch } from './brackets.ts';
|
|
2
5
|
import { CloserTracker } from './closer-tracker.ts';
|
|
3
|
-
import { planBlockComment, planLineComments } from './comments.ts';
|
|
4
|
-
import { planEnter } from './enter.ts';
|
|
5
6
|
import { planCodeBlock } from './code-blocks.ts';
|
|
7
|
+
import { planBlockComment, planLineComments } from './comments.ts';
|
|
6
8
|
import { planCompleteStatement } from './complete-statement.ts';
|
|
7
|
-
import { planMoveStatement, statementMoveMode } from './statement-move.ts';
|
|
8
|
-
import { planHippie, type HippieCycle, type HippieOptions } from './hippie.ts';
|
|
9
|
-
import { planAutoIndent, planJoinLines, planToggleCase, properIndent, spacingBetween } from './line-commands.ts';
|
|
10
|
-
import { mapOffset, offsetMapper } from './offsets.ts';
|
|
11
|
-
import { planPaste } from './paste.ts';
|
|
12
|
-
import type { EnterOptions, EnterPlan } from './enter.ts';
|
|
13
9
|
import type { EditPlan, EditSource } from './edit-source.ts';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
10
|
+
import { planEnter } from './enter.ts';
|
|
11
|
+
import type { EnterOptions, EnterPlan } from './enter.ts';
|
|
16
12
|
import { applyFoldHints, markFileHeader } from './fold-roles.ts';
|
|
13
|
+
import { planHippie, type HippieCycle, type HippieOptions } from './hippie.ts';
|
|
14
|
+
import { isPlainText, vueRegionAt } from './languages.ts';
|
|
17
15
|
import { lexicalFolds } from './lexical-folds.ts';
|
|
18
|
-
import { rangeOf, whitespaceOf } from './line-text.ts';
|
|
19
|
-
import { isQuote, replacesComparison, surround, swapQuotes, templateLiteralEdits, templateString } from './typing-handlers.ts';
|
|
20
|
-
import { scanBrackets } from './brackets.ts';
|
|
21
|
-
import type { BracketIndex, BracketMatch } from './brackets.ts';
|
|
22
|
-
import { BracketTracker } from './bracket-tracker.ts';
|
|
23
16
|
import { hasSmartSemicolon, isPhp } from './lexical.ts';
|
|
17
|
+
import { planAutoIndent, planJoinLines, planToggleCase, properIndent, spacingBetween } from './line-commands.ts';
|
|
18
|
+
import { type LineOrder, planConvertIndents, planLineOrder } from './line-order.ts';
|
|
19
|
+
import { rangeOf, whitespaceOf } from './line-text.ts';
|
|
20
|
+
import { mapOffset, offsetMapper } from './offsets.ts';
|
|
21
|
+
import { planPaste } from './paste.ts';
|
|
22
|
+
import { postfixOperands, type PostfixOperand } from './postfix-operands.ts';
|
|
24
23
|
import { clampInteger, TextRope, ROPE_CHUNK_SIZE } from './rope.ts';
|
|
25
24
|
import type { DocumentLine } from './rope.ts';
|
|
25
|
+
import { scriptSource } from './script-source.ts';
|
|
26
26
|
import { findMatches, findMatchFrom, replacementText, splitsSurrogate } from './search.ts';
|
|
27
27
|
import type { FindMatch, FindNextOptions, FindOptions } from './search.ts';
|
|
28
|
+
import { planMoveStatement, statementMoveMode } from './statement-move.ts';
|
|
28
29
|
import { dedupeFoldingRanges, deriveFoldingRanges, indentationColumn, scanStructure, tabWidth } from './structure.ts';
|
|
29
30
|
import type { FoldingOptions, FoldingRange, StructureRange } from './structure.ts';
|
|
31
|
+
import { surroundShape, type SurroundShape } from './surround-shape.ts';
|
|
32
|
+
import { placeAt, type TextPlace } from './text-places.ts';
|
|
33
|
+
import { todosInLines, type TodoMatch, type TodoOptions } from './todo.ts';
|
|
30
34
|
import type {
|
|
31
35
|
CommandOptions,
|
|
32
36
|
ContentEdit,
|
|
@@ -40,13 +44,9 @@ import type {
|
|
|
40
44
|
TextEdit
|
|
41
45
|
} from './types.ts';
|
|
42
46
|
import { TypingContexts } from './typing-context.ts';
|
|
43
|
-
import { placeAt, type TextPlace } from './text-places.ts';
|
|
44
|
-
import { postfixOperands, type PostfixOperand } from './postfix-operands.ts';
|
|
45
|
-
import { surroundShape, type SurroundShape } from './surround-shape.ts';
|
|
46
|
-
import { unwrapTargets, type UnwrapTarget } from './unwrap.ts';
|
|
47
47
|
import type { TypingContext } from './typing-context.ts';
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
48
|
+
import { isQuote, replacesComparison, surround, swapQuotes, templateLiteralEdits, templateString } from './typing-handlers.ts';
|
|
49
|
+
import { unwrapTargets, type UnwrapTarget } from './unwrap.ts';
|
|
50
50
|
import { ModifiedStretches, planWhitespaceCleanup, type WhitespaceCleanupOptions } from './whitespace-cleanup.ts';
|
|
51
51
|
import { isHumpBoundary, isWordBoundary } from './words.ts';
|
|
52
52
|
|
package/src/edit-source.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { VueRegion } from './languages.ts';
|
|
2
2
|
import type { DocumentLine } from './rope.ts';
|
|
3
|
-
import type { TypingContext } from './typing-context.ts';
|
|
4
3
|
import type { Selection, TextEdit } from './types.ts';
|
|
4
|
+
import type { TypingContext } from './typing-context.ts';
|
|
5
5
|
|
|
6
6
|
/* What the editing features that go by the lines around a caret read from the document. */
|
|
7
7
|
export interface EditSource {
|
package/src/enter.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { EditSource } from './edit-source.ts';
|
|
2
1
|
import { editRegions } from './edit-regions.ts';
|
|
2
|
+
import type { EditSource } from './edit-source.ts';
|
|
3
3
|
import { commentSyntax } from './languages.ts';
|
|
4
4
|
import { hasHashComments, isBraced, isPhp, openers } from './lexical.ts';
|
|
5
5
|
import { whitespaceOf } from './line-text.ts';
|
package/src/lexical-folds.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { commentSyntax } from './languages.ts';
|
|
2
2
|
import { textStart } from './line-text.ts';
|
|
3
|
-
import type { FoldRole, FoldingRange } from './structure.ts';
|
|
4
3
|
import type { DocumentLine } from './rope.ts';
|
|
4
|
+
import type { FoldRole, FoldingRange } from './structure.ts';
|
|
5
5
|
|
|
6
6
|
/* The words a line starts with when it brings another file in, by language. A language not listed here has no import list to fold. */
|
|
7
7
|
const IMPORT_WORDS = new Map<string, RegExp>();
|
package/src/line-commands.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EditPlan, EditSource } from './edit-source.ts';
|
|
2
|
-
import { commentSyntax } from './languages.ts';
|
|
3
2
|
import { caseLabel, lineContinues } from './enter.ts';
|
|
3
|
+
import { commentSyntax } from './languages.ts';
|
|
4
4
|
import { indentsByBrackets } from './lexical.ts';
|
|
5
5
|
import { isBlank, rangeOf, whitespaceOf } from './line-text.ts';
|
|
6
6
|
import { markupGuard } from './markup-regions.ts';
|
package/src/search.ts
CHANGED
package/src/statements.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { EditSource } from './edit-source.ts';
|
|
2
2
|
import { lineContinues } from './enter.ts';
|
|
3
|
-
import type { FoldingRange } from './structure.ts';
|
|
4
3
|
import { isBlank, whitespaceOf } from './line-text.ts';
|
|
4
|
+
import type { FoldingRange } from './structure.ts';
|
|
5
5
|
|
|
6
6
|
/* The indentation of a line text in columns, tabs taken to their stops. */
|
|
7
7
|
export function indentWidth(text: string, tabSize: number): number {
|
package/src/text-places.ts
CHANGED
package/src/text-span.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isHighSurrogate, isLowSurrogate } from '@adecore/utils/text';
|
|
2
|
+
|
|
1
3
|
export interface TextSpan {
|
|
2
4
|
/* UTF-16 offsets into the text before the change. */
|
|
3
5
|
readonly start: number;
|
|
@@ -6,14 +8,6 @@ export interface TextSpan {
|
|
|
6
8
|
readonly text: string;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
function isHighSurrogate(code: number): boolean {
|
|
10
|
-
return code >= 0xd800 && code <= 0xdbff;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function isLowSurrogate(code: number): boolean {
|
|
14
|
-
return code >= 0xdc00 && code <= 0xdfff;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
11
|
/*
|
|
18
12
|
* The one stretch that differs between two texts, found from both ends. Replacing only that keeps a
|
|
19
13
|
* cursor, a selection and the scroll where they were anywhere outside it, which setting the whole
|