mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 09:08:53 +01:00
Add splitLines helper function (#109869)
* Add splitLines helper function I noticed there are a lot of places in our codebase what split strings using a hardcoded `/\r\n|\r|\n/` regular expression. This change extracts that to a new `strings.splitLines` helper * Update snippetSession.ts
This commit is contained in:
@@ -13,6 +13,7 @@ import { ExtHostDocumentsAndEditors } from './extHostDocumentsAndEditors';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { splitLines } from 'vs/base/common/strings';
|
||||
|
||||
export class ExtHostDocumentContentProvider implements ExtHostDocumentContentProvidersShape {
|
||||
|
||||
@@ -61,7 +62,7 @@ export class ExtHostDocumentContentProvider implements ExtHostDocumentContentPro
|
||||
}
|
||||
|
||||
// create lines and compare
|
||||
const lines = value.split(/\r\n|\r|\n/);
|
||||
const lines = splitLines(value);
|
||||
|
||||
// broadcast event when content changed
|
||||
if (!document.equalLines(lines)) {
|
||||
|
||||
Reference in New Issue
Block a user