@lvce-editor/editor-worker 19.75.5 → 19.75.6
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/diff-sdk.d.ts +1 -0
- package/dist/diff-sdk.js +19 -10
- package/dist/editorWorkerMain.js +19 -10
- package/package.json +1 -1
package/dist/diff-sdk.d.ts
CHANGED
|
@@ -119,6 +119,7 @@ export interface EditorState {
|
|
|
119
119
|
readonly fontFamily: string;
|
|
120
120
|
readonly fontSize: number;
|
|
121
121
|
readonly fontWeight: number;
|
|
122
|
+
readonly forceText?: boolean;
|
|
122
123
|
readonly formatOnSave?: boolean;
|
|
123
124
|
readonly gutterDecorations: readonly EditorGutterDecoration[];
|
|
124
125
|
readonly gutterWidth: number;
|
package/dist/diff-sdk.js
CHANGED
|
@@ -3815,8 +3815,9 @@ const invoke$b = async (method, ...args) => {
|
|
|
3815
3815
|
const invoke$a = async (applicationId, method, ...args) => {
|
|
3816
3816
|
return applicationId === undefined ? RendererWorker.invoke(method, ...args) : RendererWorker.invoke('Application.execute', applicationId, method, ...args);
|
|
3817
3817
|
};
|
|
3818
|
-
const readFile$1 = async (applicationId, uri) => {
|
|
3819
|
-
|
|
3818
|
+
const readFile$1 = async (applicationId, uri, encoding) => {
|
|
3819
|
+
const args = encoding === undefined ? [uri] : [uri, encoding];
|
|
3820
|
+
return applicationId === undefined ? invoke$b('FileSystem.readFile', ...args) : invoke$b('ApplicationFileSystem.execute', applicationId, 'readFile', ...args);
|
|
3820
3821
|
};
|
|
3821
3822
|
|
|
3822
3823
|
const notifyTabModifiedStatusChange = async (uri, modified, applicationId) => {
|
|
@@ -6008,7 +6009,7 @@ const FocusFindWidgetToggleReplace = 42;
|
|
|
6008
6009
|
const SourceActions = 38;
|
|
6009
6010
|
const FocusCodeGenerator = 52;
|
|
6010
6011
|
|
|
6011
|
-
const createEditor2 = (id, uri, x, y, width, height, platform, assetDir, _languageId, _tokenizePath, _useCache, applicationId, editorFileCacheEnabled = false) => {
|
|
6012
|
+
const createEditor2 = (id, uri, x, y, width, height, platform, assetDir, _languageId, _tokenizePath, _useCache, applicationId, editorFileCacheEnabled = false, forceText = false) => {
|
|
6012
6013
|
number(id);
|
|
6013
6014
|
const editor = {
|
|
6014
6015
|
...(applicationId !== undefined && {
|
|
@@ -6048,6 +6049,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir, _langua
|
|
|
6048
6049
|
fontFamily: '',
|
|
6049
6050
|
fontSize: 0,
|
|
6050
6051
|
fontWeight: 0,
|
|
6052
|
+
forceText,
|
|
6051
6053
|
gutterDecorations: [],
|
|
6052
6054
|
gutterWidth: 0,
|
|
6053
6055
|
handleOffset: 0,
|
|
@@ -14581,8 +14583,9 @@ const getBlockCommentEdits = (editor, blockComment) => {
|
|
|
14581
14583
|
|
|
14582
14584
|
const getLineComment = async editor => {
|
|
14583
14585
|
try {
|
|
14586
|
+
const offset = getOffsetAtCursor$1(editor);
|
|
14584
14587
|
const lineComment = await execute({
|
|
14585
|
-
args: [],
|
|
14588
|
+
args: [offset],
|
|
14586
14589
|
editor,
|
|
14587
14590
|
kind: 'comment',
|
|
14588
14591
|
method: 'provideComment'
|
|
@@ -17307,9 +17310,12 @@ const isExcludedFromFileCache = uri => {
|
|
|
17307
17310
|
const removeCachedEditorFile = (applicationId, uri) => {
|
|
17308
17311
|
void invoke$a(undefined, 'CacheStorage.removeEditorFileCache', applicationId || '', uri).catch(() => {});
|
|
17309
17312
|
};
|
|
17310
|
-
const readFileWithCache = async (applicationId, uri, forceReload, useCache) => {
|
|
17313
|
+
const readFileWithCache = async (applicationId, uri, forceReload, useCache, forceText) => {
|
|
17311
17314
|
if (!useCache) {
|
|
17312
|
-
return readFile$1(applicationId, uri);
|
|
17315
|
+
return readFile$1(applicationId, uri, forceText ? 'binary' : undefined);
|
|
17316
|
+
}
|
|
17317
|
+
if (forceText) {
|
|
17318
|
+
return readFile$1(applicationId, uri, 'binary');
|
|
17313
17319
|
}
|
|
17314
17320
|
if (forceReload) {
|
|
17315
17321
|
removeCachedEditorFile(applicationId, uri);
|
|
@@ -17347,9 +17353,12 @@ const readFileWithCache = async (applicationId, uri, forceReload, useCache) => {
|
|
|
17347
17353
|
}
|
|
17348
17354
|
return content;
|
|
17349
17355
|
};
|
|
17350
|
-
const readFile = (applicationId, uri, forceReload, useCache) => {
|
|
17356
|
+
const readFile = (applicationId, uri, forceReload, useCache, forceText) => {
|
|
17357
|
+
if (forceText) {
|
|
17358
|
+
return readFileWithCache(applicationId, uri, forceReload, useCache, forceText);
|
|
17359
|
+
}
|
|
17351
17360
|
if (forceReload) {
|
|
17352
|
-
return readFileWithCache(applicationId, uri, forceReload, useCache);
|
|
17361
|
+
return readFileWithCache(applicationId, uri, forceReload, useCache, forceText);
|
|
17353
17362
|
}
|
|
17354
17363
|
let applicationReads = pendingFileReads.get(applicationId);
|
|
17355
17364
|
if (!applicationReads) {
|
|
@@ -17372,7 +17381,7 @@ const readFile = (applicationId, uri, forceReload, useCache) => {
|
|
|
17372
17381
|
};
|
|
17373
17382
|
fileRead = (async () => {
|
|
17374
17383
|
try {
|
|
17375
|
-
return await readFileWithCache(applicationId, uri, forceReload, useCache);
|
|
17384
|
+
return await readFileWithCache(applicationId, uri, forceReload, useCache, forceText);
|
|
17376
17385
|
} finally {
|
|
17377
17386
|
removePendingRead();
|
|
17378
17387
|
}
|
|
@@ -17536,7 +17545,7 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
|
|
|
17536
17545
|
content = snapshot.lines.join('\n');
|
|
17537
17546
|
endOfLine = snapshot.endOfLine === 'crlf' ? 'crlf' : 'lf';
|
|
17538
17547
|
} else if (!existingEditor) {
|
|
17539
|
-
content = await readFile(state.applicationId, uri, forceReload, state.editorFileCacheEnabled === true);
|
|
17548
|
+
content = await readFile(state.applicationId, uri, forceReload, state.editorFileCacheEnabled === true, state.forceText === true);
|
|
17540
17549
|
endOfLine = getEndOfLine(content);
|
|
17541
17550
|
content = normalizeLineEndings(content);
|
|
17542
17551
|
}
|
package/dist/editorWorkerMain.js
CHANGED
|
@@ -4228,8 +4228,9 @@ const invoke$b = async (method, ...args) => {
|
|
|
4228
4228
|
const invoke$a = async (applicationId, method, ...args) => {
|
|
4229
4229
|
return applicationId === undefined ? invoke$e(method, ...args) : invoke$e('Application.execute', applicationId, method, ...args);
|
|
4230
4230
|
};
|
|
4231
|
-
const readFile$1 = async (applicationId, uri) => {
|
|
4232
|
-
|
|
4231
|
+
const readFile$1 = async (applicationId, uri, encoding) => {
|
|
4232
|
+
const args = encoding === undefined ? [uri] : [uri, encoding];
|
|
4233
|
+
return applicationId === undefined ? invoke$b('FileSystem.readFile', ...args) : invoke$b('ApplicationFileSystem.execute', applicationId, 'readFile', ...args);
|
|
4233
4234
|
};
|
|
4234
4235
|
|
|
4235
4236
|
const notifyTabModifiedStatusChange = async (uri, modified, applicationId) => {
|
|
@@ -6421,7 +6422,7 @@ const FocusFindWidgetToggleReplace = 42;
|
|
|
6421
6422
|
const SourceActions = 38;
|
|
6422
6423
|
const FocusCodeGenerator = 52;
|
|
6423
6424
|
|
|
6424
|
-
const createEditor2 = (id, uri, x, y, width, height, platform, assetDir, _languageId, _tokenizePath, _useCache, applicationId, editorFileCacheEnabled = false) => {
|
|
6425
|
+
const createEditor2 = (id, uri, x, y, width, height, platform, assetDir, _languageId, _tokenizePath, _useCache, applicationId, editorFileCacheEnabled = false, forceText = false) => {
|
|
6425
6426
|
number(id);
|
|
6426
6427
|
const editor = {
|
|
6427
6428
|
...(applicationId !== undefined && {
|
|
@@ -6461,6 +6462,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir, _langua
|
|
|
6461
6462
|
fontFamily: '',
|
|
6462
6463
|
fontSize: 0,
|
|
6463
6464
|
fontWeight: 0,
|
|
6465
|
+
forceText,
|
|
6464
6466
|
gutterDecorations: [],
|
|
6465
6467
|
gutterWidth: 0,
|
|
6466
6468
|
handleOffset: 0,
|
|
@@ -14985,8 +14987,9 @@ const getBlockCommentEdits = (editor, blockComment) => {
|
|
|
14985
14987
|
|
|
14986
14988
|
const getLineComment = async editor => {
|
|
14987
14989
|
try {
|
|
14990
|
+
const offset = getOffsetAtCursor$1(editor);
|
|
14988
14991
|
const lineComment = await execute({
|
|
14989
|
-
args: [],
|
|
14992
|
+
args: [offset],
|
|
14990
14993
|
editor,
|
|
14991
14994
|
kind: 'comment',
|
|
14992
14995
|
method: 'provideComment'
|
|
@@ -17711,9 +17714,12 @@ const isExcludedFromFileCache = uri => {
|
|
|
17711
17714
|
const removeCachedEditorFile = (applicationId, uri) => {
|
|
17712
17715
|
void invoke$a(undefined, 'CacheStorage.removeEditorFileCache', applicationId || '', uri).catch(() => {});
|
|
17713
17716
|
};
|
|
17714
|
-
const readFileWithCache = async (applicationId, uri, forceReload, useCache) => {
|
|
17717
|
+
const readFileWithCache = async (applicationId, uri, forceReload, useCache, forceText) => {
|
|
17715
17718
|
if (!useCache) {
|
|
17716
|
-
return readFile$1(applicationId, uri);
|
|
17719
|
+
return readFile$1(applicationId, uri, forceText ? 'binary' : undefined);
|
|
17720
|
+
}
|
|
17721
|
+
if (forceText) {
|
|
17722
|
+
return readFile$1(applicationId, uri, 'binary');
|
|
17717
17723
|
}
|
|
17718
17724
|
if (forceReload) {
|
|
17719
17725
|
removeCachedEditorFile(applicationId, uri);
|
|
@@ -17751,9 +17757,12 @@ const readFileWithCache = async (applicationId, uri, forceReload, useCache) => {
|
|
|
17751
17757
|
}
|
|
17752
17758
|
return content;
|
|
17753
17759
|
};
|
|
17754
|
-
const readFile = (applicationId, uri, forceReload, useCache) => {
|
|
17760
|
+
const readFile = (applicationId, uri, forceReload, useCache, forceText) => {
|
|
17761
|
+
if (forceText) {
|
|
17762
|
+
return readFileWithCache(applicationId, uri, forceReload, useCache, forceText);
|
|
17763
|
+
}
|
|
17755
17764
|
if (forceReload) {
|
|
17756
|
-
return readFileWithCache(applicationId, uri, forceReload, useCache);
|
|
17765
|
+
return readFileWithCache(applicationId, uri, forceReload, useCache, forceText);
|
|
17757
17766
|
}
|
|
17758
17767
|
let applicationReads = pendingFileReads.get(applicationId);
|
|
17759
17768
|
if (!applicationReads) {
|
|
@@ -17776,7 +17785,7 @@ const readFile = (applicationId, uri, forceReload, useCache) => {
|
|
|
17776
17785
|
};
|
|
17777
17786
|
fileRead = (async () => {
|
|
17778
17787
|
try {
|
|
17779
|
-
return await readFileWithCache(applicationId, uri, forceReload, useCache);
|
|
17788
|
+
return await readFileWithCache(applicationId, uri, forceReload, useCache, forceText);
|
|
17780
17789
|
} finally {
|
|
17781
17790
|
removePendingRead();
|
|
17782
17791
|
}
|
|
@@ -17940,7 +17949,7 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
|
|
|
17940
17949
|
content = snapshot.lines.join('\n');
|
|
17941
17950
|
endOfLine = snapshot.endOfLine === 'crlf' ? 'crlf' : 'lf';
|
|
17942
17951
|
} else if (!existingEditor) {
|
|
17943
|
-
content = await readFile(state.applicationId, uri, forceReload, state.editorFileCacheEnabled === true);
|
|
17952
|
+
content = await readFile(state.applicationId, uri, forceReload, state.editorFileCacheEnabled === true, state.forceText === true);
|
|
17944
17953
|
endOfLine = getEndOfLine(content);
|
|
17945
17954
|
content = normalizeLineEndings(content);
|
|
17946
17955
|
}
|