Skip to content

Commit 0def4f1

Browse files
author
winjo
committed
fix: remove jschardet
1 parent 80709e8 commit 0def4f1

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

packages/core/src/server/file-service/encoding.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// TODO: iconv-lite-umd 和 jschardet 使用异步加载,加快主应用启动速度
22
import { fse as fs } from '../node';
3-
import * as jschardet from 'jschardet';
3+
// import * as jschardet from 'jschardet';
44
import * as iconv from 'iconv-lite-umd';
55
import { URI } from '@ali/ide-core-common';
66
import { FileUri } from '@ali/ide-core-node';
@@ -147,7 +147,9 @@ export function detectEncodingByBuffer(buffer: Buffer): string | null {
147147
}
148148

149149
// Support encodings http://chardet.readthedocs.io/en/latest/supported-encodings.html
150-
const detected = jschardet.detect(buffer, { minimumThreshold: 0.2 });
150+
// const detected = jschardet.detect(buffer, { minimumThreshold: 0.2 });
151+
// 字符越少,识别率越低,看框架侧去解决
152+
const detected: any = null;
151153

152154
if (!detected || !detected.encoding) {
153155
return null;

packages/core/src/server/file-service/file-service.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ import {
99
DisposableCollection,
1010
isArray,
1111
isEmptyObject,
12-
Schemas,
1312
} from '@ali/ide-core-common';
1413
import { parse, ParsedPattern, match } from '@ali/ide-core-common/lib/utils/glob';
1514
import { FileChangeEvent } from '@ali/ide-core-common';
16-
import { decode, UTF8, getEncodingInfo, detectEncodingByURI } from './encoding';
15+
import { decode, UTF8, getEncodingInfo } from './encoding';
1716
import {
1817
FileSystemError,
1918
FileStat,

0 commit comments

Comments
 (0)