mirror of
https://github.com/coder/code-server.git
synced 2026-05-09 05:47:26 +02:00
Update to VS Code 1.52.1
This commit is contained in:
@@ -22,6 +22,7 @@ import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { ensureValidWordDefinition } from 'vs/editor/common/model/wordHelper';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { getCharContainingOffset } from 'vs/base/common/strings';
|
||||
|
||||
export interface IUntitledTextEditorModel extends ITextEditorModel, IModeSupport, IEncodingSupport, IWorkingCopy {
|
||||
|
||||
@@ -362,15 +363,18 @@ export class UntitledTextEditorModel extends BaseTextEditorModel implements IUnt
|
||||
|
||||
let modelFirstWordsCandidate: string | undefined = undefined;
|
||||
|
||||
const firstLineText = textEditorModel
|
||||
let firstLineText = textEditorModel
|
||||
.getValueInRange({
|
||||
startLineNumber: 1,
|
||||
endLineNumber: 1,
|
||||
startColumn: 1,
|
||||
endColumn: UntitledTextEditorModel.FIRST_LINE_NAME_CANDIDATE_MAX_LENGTH + 1 // first cap at FIRST_LINE_NAME_CANDIDATE_MAX_LENGTH
|
||||
})
|
||||
.trim().replace(/\s+/g, ' ') // normalize whitespaces
|
||||
.substr(0, UntitledTextEditorModel.FIRST_LINE_NAME_MAX_LENGTH); // finally cap at FIRST_LINE_NAME_MAX_LENGTH
|
||||
.trim().replace(/\s+/g, ' '); // normalize whitespaces
|
||||
firstLineText = firstLineText.substr(0, getCharContainingOffset( // finally cap at FIRST_LINE_NAME_MAX_LENGTH (grapheme aware #111235)
|
||||
firstLineText,
|
||||
UntitledTextEditorModel.FIRST_LINE_NAME_MAX_LENGTH)[0]
|
||||
);
|
||||
|
||||
if (firstLineText && ensureValidWordDefinition().exec(firstLineText)) {
|
||||
modelFirstWordsCandidate = firstLineText;
|
||||
|
||||
@@ -446,10 +446,18 @@ suite('Untitled text editors', () => {
|
||||
assert.equal(input.getName(), '([]}hello');
|
||||
assert.equal(model.name, '([]}hello');
|
||||
|
||||
assert.equal(counter, 4);
|
||||
model.textEditorModel.setValue('12345678901234567890123456789012345678901234567890'); // trimmed at 40chars max
|
||||
assert.equal(input.getName(), '1234567890123456789012345678901234567890');
|
||||
assert.equal(model.name, '1234567890123456789012345678901234567890');
|
||||
|
||||
model.textEditorModel.setValue('123456789012345678901234567890123456789🌞'); // do not break grapehems (#111235)
|
||||
assert.equal(input.getName(), '123456789012345678901234567890123456789');
|
||||
assert.equal(model.name, '123456789012345678901234567890123456789');
|
||||
|
||||
assert.equal(counter, 6);
|
||||
|
||||
model.textEditorModel.setValue('Hello\nWorld');
|
||||
assert.equal(counter, 5);
|
||||
assert.equal(counter, 7);
|
||||
|
||||
function createSingleEditOp(text: string, positionLineNumber: number, positionColumn: number, selectionLineNumber: number = positionLineNumber, selectionColumn: number = positionColumn): IIdentifiedSingleEditOperation {
|
||||
let range = new Range(
|
||||
@@ -468,7 +476,7 @@ suite('Untitled text editors', () => {
|
||||
}
|
||||
|
||||
model.textEditorModel.applyEdits([createSingleEditOp('hello', 2, 2)]);
|
||||
assert.equal(counter, 5); // change was not on first line
|
||||
assert.equal(counter, 7); // change was not on first line
|
||||
|
||||
input.dispose();
|
||||
model.dispose();
|
||||
|
||||
Reference in New Issue
Block a user