@kerebron/extension-codejar 0.4.5 → 0.4.7
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/esm/{extension-codejar/src/CodeJar.d.ts → CodeJar.d.ts} +1 -1
- package/esm/CodeJar.d.ts.map +1 -0
- package/esm/{extension-codejar/src/CodeJar.js → CodeJar.js} +1 -1
- package/esm/Decorator.d.ts.map +1 -0
- package/esm/{extension-codejar/src/ExtensionCodeJar.d.ts → ExtensionCodeJar.d.ts} +1 -1
- package/esm/ExtensionCodeJar.d.ts.map +1 -0
- package/esm/{extension-codejar/src/ExtensionCodeJar.js → ExtensionCodeJar.js} +2 -2
- package/esm/{extension-codejar/src/NodeCodeJar.d.ts → NodeCodeJar.d.ts} +3 -3
- package/esm/NodeCodeJar.d.ts.map +1 -0
- package/esm/{extension-codejar/src/NodeCodeJar.js → NodeCodeJar.js} +3 -3
- package/esm/{extension-codejar/src/TreeSitterHighlighter.d.ts → TreeSitterHighlighter.d.ts} +1 -1
- package/esm/TreeSitterHighlighter.d.ts.map +1 -0
- package/esm/{extension-codejar/src/TreeSitterHighlighter.js → TreeSitterHighlighter.js} +3 -8
- package/esm/{extension-codejar/src/codeJarBlockNodeView.d.ts → codeJarBlockNodeView.d.ts} +1 -1
- package/esm/codeJarBlockNodeView.d.ts.map +1 -0
- package/esm/{extension-codejar/src/codeJarBlockNodeView.js → codeJarBlockNodeView.js} +2 -2
- package/esm/codeJarLineNumbers.d.ts.map +1 -0
- package/esm/mod.d.ts +2 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/{extension-codejar/src/mod.js → mod.js} +0 -1
- package/esm/utils.d.ts.map +1 -0
- package/package.json +10 -6
- package/esm/_dnt.polyfills.d.ts +0 -101
- package/esm/_dnt.polyfills.d.ts.map +0 -1
- package/esm/_dnt.polyfills.js +0 -127
- package/esm/editor/src/CoreEditor.d.ts +0 -40
- package/esm/editor/src/CoreEditor.d.ts.map +0 -1
- package/esm/editor/src/CoreEditor.js +0 -252
- package/esm/editor/src/DummyEditorView.d.ts +0 -60
- package/esm/editor/src/DummyEditorView.d.ts.map +0 -1
- package/esm/editor/src/DummyEditorView.js +0 -277
- package/esm/editor/src/Extension.d.ts +0 -31
- package/esm/editor/src/Extension.d.ts.map +0 -1
- package/esm/editor/src/Extension.js +0 -53
- package/esm/editor/src/ExtensionManager.d.ts +0 -32
- package/esm/editor/src/ExtensionManager.d.ts.map +0 -1
- package/esm/editor/src/ExtensionManager.js +0 -260
- package/esm/editor/src/Mark.d.ts +0 -23
- package/esm/editor/src/Mark.d.ts.map +0 -1
- package/esm/editor/src/Mark.js +0 -51
- package/esm/editor/src/Node.d.ts +0 -32
- package/esm/editor/src/Node.d.ts.map +0 -1
- package/esm/editor/src/Node.js +0 -60
- package/esm/editor/src/commands/CommandManager.d.ts +0 -23
- package/esm/editor/src/commands/CommandManager.d.ts.map +0 -1
- package/esm/editor/src/commands/CommandManager.js +0 -118
- package/esm/editor/src/commands/baseCommandFactories.d.ts +0 -3
- package/esm/editor/src/commands/baseCommandFactories.d.ts.map +0 -1
- package/esm/editor/src/commands/baseCommandFactories.js +0 -836
- package/esm/editor/src/commands/createChainableState.d.ts +0 -3
- package/esm/editor/src/commands/createChainableState.d.ts.map +0 -1
- package/esm/editor/src/commands/createChainableState.js +0 -29
- package/esm/editor/src/commands/keyCommandFactories.d.ts +0 -3
- package/esm/editor/src/commands/keyCommandFactories.d.ts.map +0 -1
- package/esm/editor/src/commands/keyCommandFactories.js +0 -10
- package/esm/editor/src/commands/mod.d.ts +0 -7
- package/esm/editor/src/commands/mod.d.ts.map +0 -1
- package/esm/editor/src/commands/mod.js +0 -76
- package/esm/editor/src/commands/replaceCommandFactories.d.ts +0 -3
- package/esm/editor/src/commands/replaceCommandFactories.d.ts.map +0 -1
- package/esm/editor/src/commands/replaceCommandFactories.js +0 -94
- package/esm/editor/src/commands/types.d.ts +0 -18
- package/esm/editor/src/commands/types.d.ts.map +0 -1
- package/esm/editor/src/commands/types.js +0 -1
- package/esm/editor/src/mod.d.ts +0 -9
- package/esm/editor/src/mod.d.ts.map +0 -1
- package/esm/editor/src/mod.js +0 -8
- package/esm/editor/src/nodeToTreeString.d.ts +0 -10
- package/esm/editor/src/nodeToTreeString.d.ts.map +0 -1
- package/esm/editor/src/nodeToTreeString.js +0 -74
- package/esm/editor/src/plugins/TrackSelecionPlugin.d.ts +0 -6
- package/esm/editor/src/plugins/TrackSelecionPlugin.d.ts.map +0 -1
- package/esm/editor/src/plugins/TrackSelecionPlugin.js +0 -24
- package/esm/editor/src/plugins/input-rules/InputRulesPlugin.d.ts +0 -23
- package/esm/editor/src/plugins/input-rules/InputRulesPlugin.d.ts.map +0 -1
- package/esm/editor/src/plugins/input-rules/InputRulesPlugin.js +0 -163
- package/esm/editor/src/plugins/input-rules/mod.d.ts +0 -3
- package/esm/editor/src/plugins/input-rules/mod.d.ts.map +0 -1
- package/esm/editor/src/plugins/input-rules/mod.js +0 -2
- package/esm/editor/src/plugins/input-rules/rulebuilders.d.ts +0 -5
- package/esm/editor/src/plugins/input-rules/rulebuilders.d.ts.map +0 -1
- package/esm/editor/src/plugins/input-rules/rulebuilders.js +0 -50
- package/esm/editor/src/plugins/keymap/keymap.d.ts +0 -11
- package/esm/editor/src/plugins/keymap/keymap.d.ts.map +0 -1
- package/esm/editor/src/plugins/keymap/keymap.js +0 -125
- package/esm/editor/src/plugins/keymap/w3c-keyname.d.ts +0 -4
- package/esm/editor/src/plugins/keymap/w3c-keyname.d.ts.map +0 -1
- package/esm/editor/src/plugins/keymap/w3c-keyname.js +0 -124
- package/esm/editor/src/types.d.ts +0 -52
- package/esm/editor/src/types.d.ts.map +0 -1
- package/esm/editor/src/types.js +0 -1
- package/esm/editor/src/ui.d.ts +0 -15
- package/esm/editor/src/ui.d.ts.map +0 -1
- package/esm/editor/src/ui.js +0 -16
- package/esm/editor/src/utilities/SmartOutput.d.ts +0 -41
- package/esm/editor/src/utilities/SmartOutput.d.ts.map +0 -1
- package/esm/editor/src/utilities/SmartOutput.js +0 -228
- package/esm/editor/src/utilities/createNodeFromContent.d.ts +0 -9
- package/esm/editor/src/utilities/createNodeFromContent.d.ts.map +0 -1
- package/esm/editor/src/utilities/createNodeFromContent.js +0 -32
- package/esm/editor/src/utilities/getHtmlAttributes.d.ts +0 -9
- package/esm/editor/src/utilities/getHtmlAttributes.d.ts.map +0 -1
- package/esm/editor/src/utilities/getHtmlAttributes.js +0 -47
- package/esm/editor/src/utilities/getShadowRoot.d.ts +0 -2
- package/esm/editor/src/utilities/getShadowRoot.d.ts.map +0 -1
- package/esm/editor/src/utilities/getShadowRoot.js +0 -16
- package/esm/editor/src/utilities/mod.d.ts +0 -6
- package/esm/editor/src/utilities/mod.d.ts.map +0 -1
- package/esm/editor/src/utilities/mod.js +0 -5
- package/esm/editor/src/utilities/toRawTextResult.d.ts +0 -3
- package/esm/editor/src/utilities/toRawTextResult.d.ts.map +0 -1
- package/esm/editor/src/utilities/toRawTextResult.js +0 -21
- package/esm/extension-autocomplete/src/AutocompletePlugin.d.ts +0 -8
- package/esm/extension-autocomplete/src/AutocompletePlugin.d.ts.map +0 -1
- package/esm/extension-autocomplete/src/AutocompletePlugin.js +0 -232
- package/esm/extension-autocomplete/src/DefaultRenderer.d.ts +0 -17
- package/esm/extension-autocomplete/src/DefaultRenderer.d.ts.map +0 -1
- package/esm/extension-autocomplete/src/DefaultRenderer.js +0 -137
- package/esm/extension-autocomplete/src/ExtensionAutocomplete.d.ts +0 -26
- package/esm/extension-autocomplete/src/ExtensionAutocomplete.d.ts.map +0 -1
- package/esm/extension-autocomplete/src/ExtensionAutocomplete.js +0 -30
- package/esm/extension-autocomplete/src/createDefaultMatcher.d.ts +0 -11
- package/esm/extension-autocomplete/src/createDefaultMatcher.d.ts.map +0 -1
- package/esm/extension-autocomplete/src/createDefaultMatcher.js +0 -58
- package/esm/extension-autocomplete/src/createRegexMatcher.d.ts +0 -4
- package/esm/extension-autocomplete/src/createRegexMatcher.d.ts.map +0 -1
- package/esm/extension-autocomplete/src/createRegexMatcher.js +0 -50
- package/esm/extension-autocomplete/src/mod.d.ts +0 -3
- package/esm/extension-autocomplete/src/mod.d.ts.map +0 -1
- package/esm/extension-autocomplete/src/mod.js +0 -2
- package/esm/extension-autocomplete/src/types.d.ts +0 -60
- package/esm/extension-autocomplete/src/types.d.ts.map +0 -1
- package/esm/extension-autocomplete/src/types.js +0 -1
- package/esm/extension-basic-editor/src/ExtensionHtml.d.ts +0 -15
- package/esm/extension-basic-editor/src/ExtensionHtml.d.ts.map +0 -1
- package/esm/extension-basic-editor/src/ExtensionHtml.js +0 -108
- package/esm/extension-basic-editor/src/NodeCodeBlock.d.ts +0 -9
- package/esm/extension-basic-editor/src/NodeCodeBlock.d.ts.map +0 -1
- package/esm/extension-basic-editor/src/NodeCodeBlock.js +0 -58
- package/esm/extension-codejar/src/CodeJar.d.ts.map +0 -1
- package/esm/extension-codejar/src/Decorator.d.ts.map +0 -1
- package/esm/extension-codejar/src/ExtensionCodeJar.d.ts.map +0 -1
- package/esm/extension-codejar/src/NodeCodeJar.d.ts.map +0 -1
- package/esm/extension-codejar/src/TreeSitterHighlighter.d.ts.map +0 -1
- package/esm/extension-codejar/src/codeJarBlockNodeView.d.ts.map +0 -1
- package/esm/extension-codejar/src/codeJarLineNumbers.d.ts.map +0 -1
- package/esm/extension-codejar/src/mod.d.ts +0 -3
- package/esm/extension-codejar/src/mod.d.ts.map +0 -1
- package/esm/extension-codejar/src/utils.d.ts.map +0 -1
- package/esm/extension-lsp/src/DiagnosticPlugin.d.ts +0 -32
- package/esm/extension-lsp/src/DiagnosticPlugin.d.ts.map +0 -1
- package/esm/extension-lsp/src/DiagnosticPlugin.js +0 -131
- package/esm/extension-lsp/src/ExtensionLsp.d.ts +0 -25
- package/esm/extension-lsp/src/ExtensionLsp.d.ts.map +0 -1
- package/esm/extension-lsp/src/ExtensionLsp.js +0 -126
- package/esm/extension-lsp/src/LSPClient.d.ts +0 -56
- package/esm/extension-lsp/src/LSPClient.d.ts.map +0 -1
- package/esm/extension-lsp/src/LSPClient.js +0 -449
- package/esm/extension-lsp/src/computeIncrementalChanges.d.ts +0 -8
- package/esm/extension-lsp/src/computeIncrementalChanges.d.ts.map +0 -1
- package/esm/extension-lsp/src/computeIncrementalChanges.js +0 -82
- package/esm/extension-lsp/src/createLspAutocomplete.d.ts +0 -23
- package/esm/extension-lsp/src/createLspAutocomplete.d.ts.map +0 -1
- package/esm/extension-lsp/src/createLspAutocomplete.js +0 -68
- package/esm/extension-lsp/src/mod.d.ts +0 -4
- package/esm/extension-lsp/src/mod.d.ts.map +0 -1
- package/esm/extension-lsp/src/mod.js +0 -3
- package/esm/extension-lsp/src/workspace.d.ts +0 -62
- package/esm/extension-lsp/src/workspace.d.ts.map +0 -1
- package/esm/extension-lsp/src/workspace.js +0 -168
- package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.d.ts +0 -36
- package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.d.ts.map +0 -1
- package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.js +0 -240
- package/esm/extension-markdown/src/DocumentMarkdownTokenizer.d.ts +0 -26
- package/esm/extension-markdown/src/DocumentMarkdownTokenizer.d.ts.map +0 -1
- package/esm/extension-markdown/src/DocumentMarkdownTokenizer.js +0 -115
- package/esm/extension-markdown/src/ExtensionMarkdown.d.ts +0 -22
- package/esm/extension-markdown/src/ExtensionMarkdown.d.ts.map +0 -1
- package/esm/extension-markdown/src/ExtensionMarkdown.js +0 -48
- package/esm/extension-markdown/src/MarkdownParser.d.ts +0 -61
- package/esm/extension-markdown/src/MarkdownParser.d.ts.map +0 -1
- package/esm/extension-markdown/src/MarkdownParser.js +0 -249
- package/esm/extension-markdown/src/MarkdownSerializer.d.ts +0 -42
- package/esm/extension-markdown/src/MarkdownSerializer.d.ts.map +0 -1
- package/esm/extension-markdown/src/MarkdownSerializer.js +0 -325
- package/esm/extension-markdown/src/PositionMapper.d.ts +0 -15
- package/esm/extension-markdown/src/PositionMapper.d.ts.map +0 -1
- package/esm/extension-markdown/src/PositionMapper.js +0 -100
- package/esm/extension-markdown/src/TokenSource.d.ts +0 -11
- package/esm/extension-markdown/src/TokenSource.d.ts.map +0 -1
- package/esm/extension-markdown/src/TokenSource.js +0 -39
- package/esm/extension-markdown/src/mdToPmConverter.d.ts +0 -5
- package/esm/extension-markdown/src/mdToPmConverter.d.ts.map +0 -1
- package/esm/extension-markdown/src/mdToPmConverter.js +0 -111
- package/esm/extension-markdown/src/pmToMdConverter.d.ts +0 -16
- package/esm/extension-markdown/src/pmToMdConverter.d.ts.map +0 -1
- package/esm/extension-markdown/src/pmToMdConverter.js +0 -433
- package/esm/extension-markdown/src/token_handlers/basic_token_handlers.d.ts +0 -4
- package/esm/extension-markdown/src/token_handlers/basic_token_handlers.d.ts.map +0 -1
- package/esm/extension-markdown/src/token_handlers/basic_token_handlers.js +0 -151
- package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.d.ts +0 -3
- package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.d.ts.map +0 -1
- package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.js +0 -34
- package/esm/extension-markdown/src/token_handlers/inline_token_handlers.d.ts +0 -6
- package/esm/extension-markdown/src/token_handlers/inline_token_handlers.d.ts.map +0 -1
- package/esm/extension-markdown/src/token_handlers/inline_token_handlers.js +0 -380
- package/esm/extension-markdown/src/token_handlers/lists_token_handlers.d.ts +0 -3
- package/esm/extension-markdown/src/token_handlers/lists_token_handlers.d.ts.map +0 -1
- package/esm/extension-markdown/src/token_handlers/lists_token_handlers.js +0 -323
- package/esm/extension-markdown/src/token_handlers/table_token_handlers.d.ts +0 -9
- package/esm/extension-markdown/src/token_handlers/table_token_handlers.d.ts.map +0 -1
- package/esm/extension-markdown/src/token_handlers/table_token_handlers.js +0 -308
- package/esm/extension-markdown/src/treeSitterTokenizer.d.ts +0 -5
- package/esm/extension-markdown/src/treeSitterTokenizer.d.ts.map +0 -1
- package/esm/extension-markdown/src/treeSitterTokenizer.js +0 -769
- package/esm/extension-markdown/src/types.d.ts +0 -28
- package/esm/extension-markdown/src/types.d.ts.map +0 -1
- package/esm/extension-markdown/src/types.js +0 -131
- package/esm/extension-markdown/src/utils.d.ts +0 -8
- package/esm/extension-markdown/src/utils.d.ts.map +0 -1
- package/esm/extension-markdown/src/utils.js +0 -86
- package/esm/tree-sitter-shim/src/main.d.ts +0 -15
- package/esm/tree-sitter-shim/src/main.d.ts.map +0 -1
- package/esm/tree-sitter-shim/src/main.js +0 -25
- package/esm/tree-sitter-shim/src/tree_sitter/language.d.ts +0 -7
- package/esm/tree-sitter-shim/src/tree_sitter/language.d.ts.map +0 -1
- package/esm/tree-sitter-shim/src/tree_sitter/language.js +0 -5
- package/esm/tree-sitter-shim/src/tree_sitter/node.d.ts +0 -6
- package/esm/tree-sitter-shim/src/tree_sitter/node.d.ts.map +0 -1
- package/esm/tree-sitter-shim/src/tree_sitter/node.js +0 -1
- package/esm/tree-sitter-shim/src/tree_sitter/parser.d.ts +0 -7
- package/esm/tree-sitter-shim/src/tree_sitter/parser.d.ts.map +0 -1
- package/esm/tree-sitter-shim/src/tree_sitter/parser.js +0 -5
- package/esm/tree-sitter-shim/src/tree_sitter/tree.d.ts +0 -6
- package/esm/tree-sitter-shim/src/tree_sitter/tree.d.ts.map +0 -1
- package/esm/tree-sitter-shim/src/tree_sitter/tree.js +0 -1
- package/esm/wasm/src/mod.d.ts +0 -12
- package/esm/wasm/src/mod.d.ts.map +0 -1
- package/esm/wasm/src/mod.js +0 -48
- package/esm/wasm/wasm.d.ts +0 -138
- package/esm/wasm/wasm.d.ts.map +0 -1
- package/esm/wasm/wasm.js +0 -120
- /package/esm/{extension-codejar/src/Decorator.d.ts → Decorator.d.ts} +0 -0
- /package/esm/{extension-codejar/src/Decorator.js → Decorator.js} +0 -0
- /package/esm/{extension-codejar/src/codeJarLineNumbers.d.ts → codeJarLineNumbers.d.ts} +0 -0
- /package/esm/{extension-codejar/src/codeJarLineNumbers.js → codeJarLineNumbers.js} +0 -0
- /package/esm/{extension-codejar/src/utils.d.ts → utils.d.ts} +0 -0
- /package/esm/{extension-codejar/src/utils.js → utils.js} +0 -0
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type * as lsp from 'vscode-languageserver-protocol';
|
|
2
|
-
import type { EditorUi } from '../../editor/src/mod.js';
|
|
3
|
-
import { LSPClient } from './LSPClient.js';
|
|
4
|
-
import { PositionMapper } from '../../extension-markdown/src/PositionMapper.js';
|
|
5
|
-
export interface LspSource {
|
|
6
|
-
ui: EditorUi;
|
|
7
|
-
getMappedContent(): {
|
|
8
|
-
content: string;
|
|
9
|
-
mapper: PositionMapper;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export interface WorkspaceFile {
|
|
13
|
-
uri: string;
|
|
14
|
-
languageId: string;
|
|
15
|
-
version: number;
|
|
16
|
-
content: string;
|
|
17
|
-
source: LspSource;
|
|
18
|
-
getUi(): EditorUi | undefined;
|
|
19
|
-
mapper: PositionMapper;
|
|
20
|
-
}
|
|
21
|
-
interface WorkspaceFileUpdate {
|
|
22
|
-
file: WorkspaceFile;
|
|
23
|
-
prevDoc: string;
|
|
24
|
-
changes: lsp.TextDocumentContentChangeEvent[];
|
|
25
|
-
}
|
|
26
|
-
export declare abstract class Workspace {
|
|
27
|
-
readonly client: LSPClient;
|
|
28
|
-
abstract files: WorkspaceFile[];
|
|
29
|
-
protected isConnected: boolean;
|
|
30
|
-
constructor(client: LSPClient);
|
|
31
|
-
getFile(uri: string): WorkspaceFile | null;
|
|
32
|
-
abstract syncFiles(): readonly WorkspaceFileUpdate[];
|
|
33
|
-
requestFile(uri: string): Promise<WorkspaceFile | null>;
|
|
34
|
-
abstract openFile(uri: string, languageId: string, source: LspSource): void;
|
|
35
|
-
abstract changedFile(uri: string): void;
|
|
36
|
-
abstract closeFile(uri: string): void;
|
|
37
|
-
connected(): Promise<void>;
|
|
38
|
-
disconnected(): void;
|
|
39
|
-
getUi(uri: string): Promise<EditorUi | undefined>;
|
|
40
|
-
}
|
|
41
|
-
declare class DefaultWorkspaceFile implements WorkspaceFile {
|
|
42
|
-
readonly uri: string;
|
|
43
|
-
readonly languageId: string;
|
|
44
|
-
version: number;
|
|
45
|
-
content: string;
|
|
46
|
-
mapper: PositionMapper;
|
|
47
|
-
source: LspSource;
|
|
48
|
-
syncedContent: string;
|
|
49
|
-
constructor(uri: string, languageId: string, version: number, content: string, mapper: PositionMapper, source: LspSource);
|
|
50
|
-
getUi(): EditorUi;
|
|
51
|
-
}
|
|
52
|
-
export declare class DefaultWorkspace extends Workspace {
|
|
53
|
-
files: DefaultWorkspaceFile[];
|
|
54
|
-
private fileVersions;
|
|
55
|
-
nextFileVersion(uri: string): number;
|
|
56
|
-
syncFiles(): WorkspaceFileUpdate[];
|
|
57
|
-
changedFile(uri: string): Promise<void>;
|
|
58
|
-
openFile(uri: string, languageId: string, source: LspSource): void;
|
|
59
|
-
closeFile(uri: string): void;
|
|
60
|
-
}
|
|
61
|
-
export {};
|
|
62
|
-
//# sourceMappingURL=workspace.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/extension-lsp/src/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,gCAAgC,CAAC;AAG3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAGhF,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,QAAQ,CAAC;IACb,gBAAgB,IAAI;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,cAAc,CAAA;KAAE,CAAC;CACjE;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,IAAI,QAAQ,GAAG,SAAS,CAAC;IAC9B,MAAM,EAAE,cAAc,CAAC;CACxB;AAED,UAAU,mBAAmB;IAC3B,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,GAAG,CAAC,8BAA8B,EAAE,CAAC;CAC/C;AAED,8BAAsB,SAAS;IAK3B,QAAQ,CAAC,MAAM,EAAE,SAAS;IAJ5B,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,CAAC;IAChC,SAAS,CAAC,WAAW,UAAS;gBAGnB,MAAM,EAAE,SAAS;IAG5B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI;IAI1C,QAAQ,CAAC,SAAS,IAAI,SAAS,mBAAmB,EAAE;IAEpD,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAIvD,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI;IAC3E,QAAQ,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IACvC,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAE/B,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAOhC,YAAY,IAAI,IAAI;IAOpB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;CAIlD;AAED,cAAM,oBAAqB,YAAW,aAAa;IAG/C,QAAQ,CAAC,GAAG,EAAE,MAAM;IACpB,QAAQ,CAAC,UAAU,EAAE,MAAM;IACpB,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,cAAc;IACtB,MAAM,EAAE,SAAS;IAPnB,aAAa,EAAE,MAAM,CAAM;gBAEvB,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,SAAS;IAI1B,KAAK;CAGN;AAED,qBAAa,gBAAiB,SAAQ,SAAS;IAC7C,KAAK,EAAE,oBAAoB,EAAE,CAAM;IACnC,OAAO,CAAC,YAAY,CAAkD;IAEtE,eAAe,CAAC,GAAG,EAAE,MAAM;IAI3B,SAAS;IAaH,WAAW,CAAC,GAAG,EAAE,MAAM;IAkC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS;IAsB3D,SAAS,CAAC,GAAG,EAAE,MAAM;CAOtB"}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { TextDocumentSyncKind } from 'vscode-languageserver-protocol';
|
|
2
|
-
import { computeIncrementalChanges } from './computeIncrementalChanges.js';
|
|
3
|
-
export class Workspace {
|
|
4
|
-
constructor(client) {
|
|
5
|
-
Object.defineProperty(this, "client", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
writable: true,
|
|
9
|
-
value: client
|
|
10
|
-
});
|
|
11
|
-
Object.defineProperty(this, "isConnected", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
configurable: true,
|
|
14
|
-
writable: true,
|
|
15
|
-
value: false
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
getFile(uri) {
|
|
19
|
-
return this.files.find((f) => f.uri == uri) || null;
|
|
20
|
-
}
|
|
21
|
-
requestFile(uri) {
|
|
22
|
-
return Promise.resolve(this.getFile(uri));
|
|
23
|
-
}
|
|
24
|
-
async connected() {
|
|
25
|
-
this.isConnected = true;
|
|
26
|
-
for await (const file of this.files) {
|
|
27
|
-
const result = await this.client.didOpen(file);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
disconnected() {
|
|
31
|
-
for (const file of this.files) {
|
|
32
|
-
this.client.workspace.closeFile(file.uri);
|
|
33
|
-
}
|
|
34
|
-
this.isConnected = false;
|
|
35
|
-
}
|
|
36
|
-
getUi(uri) {
|
|
37
|
-
const file = this.getFile(uri);
|
|
38
|
-
return Promise.resolve(file ? file.getUi() : undefined);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
class DefaultWorkspaceFile {
|
|
42
|
-
constructor(uri, languageId, version, content, mapper, source) {
|
|
43
|
-
Object.defineProperty(this, "uri", {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
configurable: true,
|
|
46
|
-
writable: true,
|
|
47
|
-
value: uri
|
|
48
|
-
});
|
|
49
|
-
Object.defineProperty(this, "languageId", {
|
|
50
|
-
enumerable: true,
|
|
51
|
-
configurable: true,
|
|
52
|
-
writable: true,
|
|
53
|
-
value: languageId
|
|
54
|
-
});
|
|
55
|
-
Object.defineProperty(this, "version", {
|
|
56
|
-
enumerable: true,
|
|
57
|
-
configurable: true,
|
|
58
|
-
writable: true,
|
|
59
|
-
value: version
|
|
60
|
-
});
|
|
61
|
-
Object.defineProperty(this, "content", {
|
|
62
|
-
enumerable: true,
|
|
63
|
-
configurable: true,
|
|
64
|
-
writable: true,
|
|
65
|
-
value: content
|
|
66
|
-
});
|
|
67
|
-
Object.defineProperty(this, "mapper", {
|
|
68
|
-
enumerable: true,
|
|
69
|
-
configurable: true,
|
|
70
|
-
writable: true,
|
|
71
|
-
value: mapper
|
|
72
|
-
});
|
|
73
|
-
Object.defineProperty(this, "source", {
|
|
74
|
-
enumerable: true,
|
|
75
|
-
configurable: true,
|
|
76
|
-
writable: true,
|
|
77
|
-
value: source
|
|
78
|
-
});
|
|
79
|
-
Object.defineProperty(this, "syncedContent", {
|
|
80
|
-
enumerable: true,
|
|
81
|
-
configurable: true,
|
|
82
|
-
writable: true,
|
|
83
|
-
value: ''
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
getUi() {
|
|
87
|
-
return this.source.ui;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
export class DefaultWorkspace extends Workspace {
|
|
91
|
-
constructor() {
|
|
92
|
-
super(...arguments);
|
|
93
|
-
Object.defineProperty(this, "files", {
|
|
94
|
-
enumerable: true,
|
|
95
|
-
configurable: true,
|
|
96
|
-
writable: true,
|
|
97
|
-
value: []
|
|
98
|
-
});
|
|
99
|
-
Object.defineProperty(this, "fileVersions", {
|
|
100
|
-
enumerable: true,
|
|
101
|
-
configurable: true,
|
|
102
|
-
writable: true,
|
|
103
|
-
value: Object.create(null)
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
nextFileVersion(uri) {
|
|
107
|
-
return this.fileVersions[uri] = (this.fileVersions[uri] ?? -1) + 1;
|
|
108
|
-
}
|
|
109
|
-
syncFiles() {
|
|
110
|
-
if (!this.client.supportSync) {
|
|
111
|
-
return [];
|
|
112
|
-
}
|
|
113
|
-
const result = [];
|
|
114
|
-
for (const file of this.files) {
|
|
115
|
-
this.changedFile(file.uri);
|
|
116
|
-
}
|
|
117
|
-
return result;
|
|
118
|
-
}
|
|
119
|
-
async changedFile(uri) {
|
|
120
|
-
const file = this.files.find((f) => f.uri == uri) || null;
|
|
121
|
-
if (file) {
|
|
122
|
-
const { content, mapper } = file.source.getMappedContent();
|
|
123
|
-
if (!this.isConnected) {
|
|
124
|
-
file.content = content;
|
|
125
|
-
file.mapper = mapper;
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
if (await this.client.notification('textDocument/didChange', {
|
|
129
|
-
textDocument: { uri: file.uri, version: file.version },
|
|
130
|
-
contentChanges: contentChangesFor(file, content, mapper, this.client.supportSync == TextDocumentSyncKind.Incremental),
|
|
131
|
-
})) {
|
|
132
|
-
file.syncedContent = file.content;
|
|
133
|
-
file.content = content;
|
|
134
|
-
file.mapper = mapper;
|
|
135
|
-
file.version = this.nextFileVersion(file.uri);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
openFile(uri, languageId, source) {
|
|
140
|
-
// if (uri) {}
|
|
141
|
-
if (this.getFile(uri)) {
|
|
142
|
-
this.closeFile(uri);
|
|
143
|
-
}
|
|
144
|
-
const mappedContent = source.getMappedContent();
|
|
145
|
-
const { content, mapper } = mappedContent;
|
|
146
|
-
const file = new DefaultWorkspaceFile(uri, languageId, this.nextFileVersion(uri), content, mapper, source);
|
|
147
|
-
this.files.push(file);
|
|
148
|
-
this.client.didOpen(file);
|
|
149
|
-
}
|
|
150
|
-
closeFile(uri) {
|
|
151
|
-
const file = this.getFile(uri);
|
|
152
|
-
if (file) {
|
|
153
|
-
this.files = this.files.filter((f) => f.uri !== uri);
|
|
154
|
-
this.client.didClose(uri);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
var Sync;
|
|
159
|
-
(function (Sync) {
|
|
160
|
-
Sync[Sync["AlwaysIfSmaller"] = 1024] = "AlwaysIfSmaller";
|
|
161
|
-
})(Sync || (Sync = {}));
|
|
162
|
-
function contentChangesFor(file, newContent, mapper, supportInc) {
|
|
163
|
-
if (!supportInc || newContent.length < Sync.AlwaysIfSmaller) {
|
|
164
|
-
return [{ text: newContent }];
|
|
165
|
-
}
|
|
166
|
-
const changes = computeIncrementalChanges(file.content, newContent);
|
|
167
|
-
return changes.reverse();
|
|
168
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { Mark, Node } from 'prosemirror-model';
|
|
2
|
-
import { Token } from './types.js';
|
|
3
|
-
export type MarkTokenizerSpec = {
|
|
4
|
-
open?: string | ((mark: Mark) => Token);
|
|
5
|
-
close?: string | ((mark: Mark) => Token);
|
|
6
|
-
mixable?: boolean;
|
|
7
|
-
expelEnclosingWhitespace?: boolean;
|
|
8
|
-
escape?: boolean;
|
|
9
|
-
};
|
|
10
|
-
export type DocumentMarkdownTokenizerSpec = {
|
|
11
|
-
open?: string | ((node: Node) => Token);
|
|
12
|
-
close?: string | ((node: Node) => Token);
|
|
13
|
-
selfClose?: string | ((node: Node) => Token);
|
|
14
|
-
};
|
|
15
|
-
export declare class DocumentMarkdownInlineTokenizer {
|
|
16
|
-
readonly nodes: {
|
|
17
|
-
[node: string]: (node: Node, index: number) => DocumentMarkdownTokenizerSpec;
|
|
18
|
-
};
|
|
19
|
-
readonly marks: {
|
|
20
|
-
[mark: string]: MarkTokenizerSpec;
|
|
21
|
-
};
|
|
22
|
-
readonly options: {
|
|
23
|
-
hardBreakNodeName: string;
|
|
24
|
-
};
|
|
25
|
-
constructor(nodes: {
|
|
26
|
-
[node: string]: (node: Node, index: number) => DocumentMarkdownTokenizerSpec;
|
|
27
|
-
}, marks: {
|
|
28
|
-
[mark: string]: MarkTokenizerSpec;
|
|
29
|
-
}, options: {
|
|
30
|
-
hardBreakNodeName: string;
|
|
31
|
-
});
|
|
32
|
-
private getMark;
|
|
33
|
-
renderInline(parent: Node, currentPos: number, level: number): Array<Token>;
|
|
34
|
-
markString(mark: Mark, open: boolean, tokens: Token[]): void;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=DocumentMarkdownInlineTokenizer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentMarkdownInlineTokenizer.d.ts","sourceRoot":"","sources":["../../../src/extension-markdown/src/DocumentMarkdownInlineTokenizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,KAAK,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,KAAK,CAAC,CAAC;IACzC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,KAAK,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,KAAK,CAAC,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,KAAK,CAAC,CAAC;CAC9C,CAAC;AAuCF,qBAAa,+BAA+B;IAExC,QAAQ,CAAC,KAAK,EAAE;QACd,CAAC,IAAI,EAAE,MAAM,GAAG,CACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,KACV,6BAA6B,CAAC;KACpC;IACD,QAAQ,CAAC,KAAK,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAA;KAAE;IACrD,QAAQ,CAAC,OAAO,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAA;KAAE;gBAPtC,KAAK,EAAE;QACd,CAAC,IAAI,EAAE,MAAM,GAAG,CACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,KACV,6BAA6B,CAAC;KACpC,EACQ,KAAK,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAA;KAAE,EAC5C,OAAO,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAA;KAAE;IAIjD,OAAO,CAAC,OAAO;IAaf,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC;IAwK3E,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE;CAoCtD"}
|
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import { Token } from './types.js';
|
|
2
|
-
const blankMark = { open: '', close: '', mixable: true };
|
|
3
|
-
const blankNode = { open: '', close: '' };
|
|
4
|
-
function generateInlineTokens(input) {
|
|
5
|
-
const tokens = [];
|
|
6
|
-
let currentPos = -1;
|
|
7
|
-
let currentText = '';
|
|
8
|
-
for (const [text, inlinePos] of input) {
|
|
9
|
-
if (true || currentPos !== inlinePos) {
|
|
10
|
-
if (currentText.length > 0) {
|
|
11
|
-
const token = new Token('text', '', 0);
|
|
12
|
-
token.meta = 'generateInline1';
|
|
13
|
-
token.map = [currentPos];
|
|
14
|
-
token.content = currentText;
|
|
15
|
-
tokens.push(token);
|
|
16
|
-
}
|
|
17
|
-
currentText = '';
|
|
18
|
-
currentPos = inlinePos;
|
|
19
|
-
}
|
|
20
|
-
currentText += text;
|
|
21
|
-
}
|
|
22
|
-
if (currentText.length > 0) {
|
|
23
|
-
const token = new Token('text', '', 0);
|
|
24
|
-
token.meta = 'generateInline2';
|
|
25
|
-
token.map = [currentPos];
|
|
26
|
-
token.content = currentText;
|
|
27
|
-
tokens.push(token);
|
|
28
|
-
}
|
|
29
|
-
return tokens;
|
|
30
|
-
}
|
|
31
|
-
export class DocumentMarkdownInlineTokenizer {
|
|
32
|
-
constructor(nodes, marks, options) {
|
|
33
|
-
Object.defineProperty(this, "nodes", {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
configurable: true,
|
|
36
|
-
writable: true,
|
|
37
|
-
value: nodes
|
|
38
|
-
});
|
|
39
|
-
Object.defineProperty(this, "marks", {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
configurable: true,
|
|
42
|
-
writable: true,
|
|
43
|
-
value: marks
|
|
44
|
-
});
|
|
45
|
-
Object.defineProperty(this, "options", {
|
|
46
|
-
enumerable: true,
|
|
47
|
-
configurable: true,
|
|
48
|
-
writable: true,
|
|
49
|
-
value: options
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
getMark(name) {
|
|
53
|
-
let info = this.marks[name];
|
|
54
|
-
if (!info) {
|
|
55
|
-
// if (this.options.strict !== false) {
|
|
56
|
-
// throw new Error(
|
|
57
|
-
// `Mark type \`${name}\` not supported by Markdown renderer`,
|
|
58
|
-
// );
|
|
59
|
-
// }
|
|
60
|
-
return blankMark;
|
|
61
|
-
}
|
|
62
|
-
return info;
|
|
63
|
-
}
|
|
64
|
-
renderInline(parent, currentPos, level) {
|
|
65
|
-
const active = [];
|
|
66
|
-
const trailing = [];
|
|
67
|
-
const inlineTokens = [];
|
|
68
|
-
const progress = (node, offset, index) => {
|
|
69
|
-
const inlinePos = currentPos + offset;
|
|
70
|
-
let marks = node ? node.marks : [];
|
|
71
|
-
// Remove marks from `hard_break` that are the last node inside
|
|
72
|
-
// that mark to prevent parser edge cases with new lines just
|
|
73
|
-
// before closing marks.
|
|
74
|
-
// TODO:
|
|
75
|
-
if (node && node.type.name === this.options.hardBreakNodeName) {
|
|
76
|
-
marks = marks.filter((m) => {
|
|
77
|
-
if (index + 1 == parent.childCount)
|
|
78
|
-
return false;
|
|
79
|
-
let next = parent.child(index + 1);
|
|
80
|
-
return m.isInSet(next.marks) &&
|
|
81
|
-
(!next.isText || /\S/.test(next.text));
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
const leading = trailing.splice(0, trailing.length);
|
|
85
|
-
// If whitespace has to be expelled from the node, adjust
|
|
86
|
-
// leading and trailing accordingly.
|
|
87
|
-
if (node.isText && marks.some((mark) => {
|
|
88
|
-
let info = this.getMark(mark.type.name);
|
|
89
|
-
return info && info.expelEnclosingWhitespace && !mark.isInSet(active);
|
|
90
|
-
})) {
|
|
91
|
-
let [_, lead, rest] = /^(\s*)(.*)$/m.exec(node.text);
|
|
92
|
-
if (lead) {
|
|
93
|
-
leading.push([lead, inlinePos]);
|
|
94
|
-
node = rest ? node.withText(rest) : null;
|
|
95
|
-
if (!node)
|
|
96
|
-
marks = active;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
if (node.isText && marks.some((mark) => {
|
|
100
|
-
let info = this.getMark(mark.type.name);
|
|
101
|
-
return info && info.expelEnclosingWhitespace &&
|
|
102
|
-
(index == parent.childCount - 1 ||
|
|
103
|
-
!mark.isInSet(parent.child(index + 1).marks));
|
|
104
|
-
})) {
|
|
105
|
-
let [_, rest, trail] = /^(.*?)(\s*)$/m.exec(node.text);
|
|
106
|
-
if (trail) {
|
|
107
|
-
trailing.push([trail, inlinePos]);
|
|
108
|
-
node = rest ? node.withText(rest) : null;
|
|
109
|
-
if (!node)
|
|
110
|
-
marks = active;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
let inner = marks.length ? marks[marks.length - 1] : null;
|
|
114
|
-
let noEsc = inner && this.getMark(inner.type.name).escape === false;
|
|
115
|
-
let len = marks.length - (noEsc ? 1 : 0);
|
|
116
|
-
// Try to reorder 'mixable' marks, such as em and strong, which
|
|
117
|
-
// in Markdown may be opened and closed in different order, so
|
|
118
|
-
// that order of the marks for the token matches the order in
|
|
119
|
-
// active.
|
|
120
|
-
outer: for (let i = 0; i < len; i++) {
|
|
121
|
-
let mark = marks[i];
|
|
122
|
-
if (!this.getMark(mark.type.name).mixable)
|
|
123
|
-
break;
|
|
124
|
-
for (let j = 0; j < active.length; j++) {
|
|
125
|
-
let other = active[j];
|
|
126
|
-
if (!this.getMark(other.type.name).mixable)
|
|
127
|
-
break;
|
|
128
|
-
if (mark.eq(other)) {
|
|
129
|
-
if (i > j) {
|
|
130
|
-
marks = marks.slice(0, j).concat(mark).concat(marks.slice(j, i))
|
|
131
|
-
.concat(marks.slice(i + 1, len));
|
|
132
|
-
}
|
|
133
|
-
else if (j > i) {
|
|
134
|
-
marks = marks.slice(0, i).concat(marks.slice(i + 1, j)).concat(mark).concat(marks.slice(j, len));
|
|
135
|
-
}
|
|
136
|
-
continue outer;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
// Find the prefix of the mark set that didn't change
|
|
141
|
-
let keep = 0;
|
|
142
|
-
while (keep < Math.min(active.length, len) && marks[keep].eq(active[keep]))
|
|
143
|
-
++keep;
|
|
144
|
-
// Close the marks that need to be closed
|
|
145
|
-
while (keep < active.length) {
|
|
146
|
-
const x = active.pop();
|
|
147
|
-
this.markString(x, false, inlineTokens);
|
|
148
|
-
}
|
|
149
|
-
// Output any previously expelled trailing whitespace outside the marks
|
|
150
|
-
inlineTokens.push(...generateInlineTokens(leading.splice(0, leading.length)));
|
|
151
|
-
// Open the marks that need to be opened
|
|
152
|
-
while (active.length < len) {
|
|
153
|
-
let add = marks[active.length];
|
|
154
|
-
active.push(add);
|
|
155
|
-
this.markString(add, true, inlineTokens);
|
|
156
|
-
}
|
|
157
|
-
// Render the node. Special case code marks, since their content
|
|
158
|
-
// may not be escaped.
|
|
159
|
-
if (noEsc && node.isText) {
|
|
160
|
-
this.markString(inner, true, inlineTokens);
|
|
161
|
-
if (node.text) {
|
|
162
|
-
const token = new Token('text', '', 0);
|
|
163
|
-
token.meta = 'noEscText';
|
|
164
|
-
token.map = [inlinePos];
|
|
165
|
-
token.content = node.text;
|
|
166
|
-
inlineTokens.push(token);
|
|
167
|
-
}
|
|
168
|
-
this.markString(inner, false, inlineTokens);
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
const nodeSpec = this.nodes[node.type.name]
|
|
172
|
-
? this.nodes[node.type.name](node, currentPos)
|
|
173
|
-
: blankNode;
|
|
174
|
-
let tag = '';
|
|
175
|
-
if (node.type.spec.toDOM) {
|
|
176
|
-
const dom = node.type.spec.toDOM(node);
|
|
177
|
-
if (Array.isArray(dom) && dom.length > 0) {
|
|
178
|
-
tag = dom[0];
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
if (nodeSpec.selfClose) {
|
|
182
|
-
if (typeof nodeSpec.selfClose === 'string') {
|
|
183
|
-
const token = new Token(nodeSpec.selfClose, tag, 0);
|
|
184
|
-
token.meta = 'nodeSpec.selfClose';
|
|
185
|
-
token.level = level;
|
|
186
|
-
token.map = [inlinePos];
|
|
187
|
-
inlineTokens.push(token);
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
const token = nodeSpec.selfClose(node);
|
|
191
|
-
token.meta = '!nodeSpec.selfClose';
|
|
192
|
-
token.level = level;
|
|
193
|
-
token.map = [inlinePos];
|
|
194
|
-
inlineTokens.push(token);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
parent.forEach((child, offset, index) => progress(child, offset, index));
|
|
200
|
-
// Close the marks that need to be closed
|
|
201
|
-
while (active.length > 0) {
|
|
202
|
-
const x = active.pop();
|
|
203
|
-
this.markString(x, false, inlineTokens);
|
|
204
|
-
}
|
|
205
|
-
// Output any previously expelled trailing whitespace outside the marks
|
|
206
|
-
inlineTokens.push(...generateInlineTokens(trailing.splice(0, trailing.length)));
|
|
207
|
-
return inlineTokens;
|
|
208
|
-
}
|
|
209
|
-
markString(mark, open, tokens) {
|
|
210
|
-
let info = this.getMark(mark.type.name);
|
|
211
|
-
let value = open ? info.open : info.close;
|
|
212
|
-
if (!value) {
|
|
213
|
-
/** Skip unknown marks (like textColor, highlight) - they'll be lost in markdown but won't crash */
|
|
214
|
-
console.warn('Unsupported mark type for markdown: ' + mark.type.name +
|
|
215
|
-
', available types: ' +
|
|
216
|
-
Object.keys(this.marks).join(', ') + '. Mark will be ignored.');
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
const token = typeof value == 'string' ? value : value(mark);
|
|
220
|
-
let tag = '';
|
|
221
|
-
if (mark.type.spec.toDOM) {
|
|
222
|
-
const dom = mark.type.spec.toDOM(mark, true);
|
|
223
|
-
if (Array.isArray(dom) && dom.length > 0) {
|
|
224
|
-
tag = dom[0];
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
if (typeof value === 'string') {
|
|
228
|
-
const token = new Token(value, tag, open ? 1 : -1);
|
|
229
|
-
token.meta = 'markString';
|
|
230
|
-
tokens.push(token);
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
const token = value(mark);
|
|
234
|
-
if (token) {
|
|
235
|
-
token.meta = token.meta || 'markString()';
|
|
236
|
-
tokens.push(token);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { Node } from 'prosemirror-model';
|
|
2
|
-
import { Token } from './types.js';
|
|
3
|
-
import { DocumentMarkdownInlineTokenizer, DocumentMarkdownTokenizerSpec, MarkTokenizerSpec } from './DocumentMarkdownInlineTokenizer.js';
|
|
4
|
-
export declare class DocumentMarkdownTokenizer {
|
|
5
|
-
readonly nodes: {
|
|
6
|
-
[node: string]: (node: Node, index: number) => DocumentMarkdownTokenizerSpec;
|
|
7
|
-
};
|
|
8
|
-
readonly marks: {
|
|
9
|
-
[mark: string]: MarkTokenizerSpec;
|
|
10
|
-
};
|
|
11
|
-
readonly options: {
|
|
12
|
-
hardBreakNodeName: string;
|
|
13
|
-
};
|
|
14
|
-
private tokens;
|
|
15
|
-
inlineTokenizer: DocumentMarkdownInlineTokenizer;
|
|
16
|
-
constructor(nodes: {
|
|
17
|
-
[node: string]: (node: Node, index: number) => DocumentMarkdownTokenizerSpec;
|
|
18
|
-
}, marks: {
|
|
19
|
-
[mark: string]: MarkTokenizerSpec;
|
|
20
|
-
}, options?: {
|
|
21
|
-
hardBreakNodeName: string;
|
|
22
|
-
});
|
|
23
|
-
iterateNode(node: Node, currentPos: number, level?: number): void;
|
|
24
|
-
serialize(content: Node, options?: {}): Token[];
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=DocumentMarkdownTokenizer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentMarkdownTokenizer.d.ts","sourceRoot":"","sources":["../../../src/extension-markdown/src/DocumentMarkdownTokenizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EACL,+BAA+B,EAC/B,6BAA6B,EAC7B,iBAAiB,EAClB,MAAM,sCAAsC,CAAC;AAI9C,qBAAa,yBAAyB;IAKlC,QAAQ,CAAC,KAAK,EAAE;QACd,CAAC,IAAI,EAAE,MAAM,GAAG,CACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,KACV,6BAA6B,CAAC;KACpC;IACD,QAAQ,CAAC,KAAK,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAA;KAAE;IACrD,QAAQ,CAAC,OAAO,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAA;KAAE;IAXjD,OAAO,CAAC,MAAM,CAAoB;IAClC,eAAe,EAAE,+BAA+B,CAAC;gBAGtC,KAAK,EAAE;QACd,CAAC,IAAI,EAAE,MAAM,GAAG,CACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,KACV,6BAA6B,CAAC;KACpC,EACQ,KAAK,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAA;KAAE,EAC5C,OAAO,GAAE;QAAE,iBAAiB,EAAE,MAAM,CAAA;KAE5C;IASH,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,SAAK;IA8EtD,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,GAAE,EAAO,GAAG,KAAK,EAAE;CAIpD"}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { Token } from './types.js';
|
|
2
|
-
import { DocumentMarkdownInlineTokenizer, } from './DocumentMarkdownInlineTokenizer.js';
|
|
3
|
-
const blankNode = { open: '', close: '' };
|
|
4
|
-
export class DocumentMarkdownTokenizer {
|
|
5
|
-
constructor(nodes, marks, options = {
|
|
6
|
-
hardBreakNodeName: 'hard_break',
|
|
7
|
-
}) {
|
|
8
|
-
Object.defineProperty(this, "nodes", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
configurable: true,
|
|
11
|
-
writable: true,
|
|
12
|
-
value: nodes
|
|
13
|
-
});
|
|
14
|
-
Object.defineProperty(this, "marks", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
configurable: true,
|
|
17
|
-
writable: true,
|
|
18
|
-
value: marks
|
|
19
|
-
});
|
|
20
|
-
Object.defineProperty(this, "options", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
configurable: true,
|
|
23
|
-
writable: true,
|
|
24
|
-
value: options
|
|
25
|
-
});
|
|
26
|
-
Object.defineProperty(this, "tokens", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
configurable: true,
|
|
29
|
-
writable: true,
|
|
30
|
-
value: []
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(this, "inlineTokenizer", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value: void 0
|
|
37
|
-
});
|
|
38
|
-
this.inlineTokenizer = new DocumentMarkdownInlineTokenizer(nodes, marks, options);
|
|
39
|
-
}
|
|
40
|
-
iterateNode(node, currentPos, level = -1) {
|
|
41
|
-
const nodeSpec = this.nodes[node.type.name]
|
|
42
|
-
? this.nodes[node.type.name](node, currentPos)
|
|
43
|
-
: blankNode;
|
|
44
|
-
let tag = '';
|
|
45
|
-
if (node.type.spec.toDOM) {
|
|
46
|
-
const dom = node.type.spec.toDOM(node);
|
|
47
|
-
if (Array.isArray(dom) && dom.length > 0) {
|
|
48
|
-
tag = dom[0];
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (nodeSpec.open) {
|
|
52
|
-
if (typeof nodeSpec.open === 'string') {
|
|
53
|
-
const token = new Token(nodeSpec.open, tag, 1);
|
|
54
|
-
token.level = level;
|
|
55
|
-
token.meta = 'nodeSpec.open';
|
|
56
|
-
token.map = [currentPos];
|
|
57
|
-
this.tokens.push(token);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
const token = nodeSpec.open(node);
|
|
61
|
-
token.level = level;
|
|
62
|
-
token.meta = 'nodeSpec.open()';
|
|
63
|
-
token.map = [currentPos];
|
|
64
|
-
this.tokens.push(token);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (nodeSpec.selfClose) {
|
|
68
|
-
if (typeof nodeSpec.selfClose === 'string') {
|
|
69
|
-
const token = new Token(nodeSpec.selfClose, tag, 0);
|
|
70
|
-
token.level = level;
|
|
71
|
-
token.map = [currentPos];
|
|
72
|
-
this.tokens.push(token);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
const token = nodeSpec.selfClose(node);
|
|
76
|
-
token.level = level;
|
|
77
|
-
token.map = [currentPos];
|
|
78
|
-
this.tokens.push(token);
|
|
79
|
-
}
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
if (node.inlineContent) {
|
|
83
|
-
const token = new Token('inline', '', 0);
|
|
84
|
-
token.level = level + 1;
|
|
85
|
-
token.map = [currentPos];
|
|
86
|
-
this.tokens.push(token);
|
|
87
|
-
token.children = this.inlineTokenizer.renderInline(node, currentPos + 1, level + 1);
|
|
88
|
-
}
|
|
89
|
-
else if (node.childCount > 0) {
|
|
90
|
-
node.forEach((child, offset) => {
|
|
91
|
-
this.iterateNode(child, currentPos + offset + 1, level + 1);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
if (nodeSpec.close) {
|
|
95
|
-
if (typeof nodeSpec.close === 'string') {
|
|
96
|
-
const token = new Token(nodeSpec.close, tag, -1);
|
|
97
|
-
token.meta = 'nodeSpec.close';
|
|
98
|
-
token.level = level;
|
|
99
|
-
// token.map = [currentPos];
|
|
100
|
-
this.tokens.push(token);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
const token = nodeSpec.close(node);
|
|
104
|
-
token.meta = 'nodeSpec.close()';
|
|
105
|
-
token.level = level;
|
|
106
|
-
// token.map = [currentPos];
|
|
107
|
-
this.tokens.push(token);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
serialize(content, options = {}) {
|
|
112
|
-
this.iterateNode(content, -1); // doc does not have index, so I put -1 for correct calculation
|
|
113
|
-
return this.tokens;
|
|
114
|
-
}
|
|
115
|
-
}
|