Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spaces in block comment. #28169 #28238

Merged
merged 3 commits into from
Jun 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/vs/editor/contrib/comment/common/blockCommentCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@ export class BlockCommentCommand implements editorCommon.ICommand {

if (!Range.isEmpty(r)) {
// Insert block comment start
res.push(EditOperation.insert(new Position(r.startLineNumber, r.startColumn), startToken));
res.push(EditOperation.insert(new Position(r.startLineNumber, r.startColumn), startToken + ' '));

// Insert block comment end
res.push(EditOperation.insert(new Position(r.endLineNumber, r.endColumn), endToken));
res.push(EditOperation.insert(new Position(r.endLineNumber, r.endColumn), ' ' + endToken));
} else {
// Insert both continuously
res.push(EditOperation.replace(new Range(
r.startLineNumber, r.startColumn,
r.endLineNumber, r.endColumn
), startToken + endToken));
), startToken + ' ' + endToken));
}

return res;
Expand Down Expand Up @@ -145,7 +145,7 @@ export class BlockCommentCommand implements editorCommon.ICommand {
);
} else {
var srcRange = inverseEditOperations[0].range;
var deltaColumn = this._usedEndToken ? -this._usedEndToken.length : 0;
var deltaColumn = this._usedEndToken ? -this._usedEndToken.length - 1 : 0; // minus 1 space before endToken
return new Selection(
srcRange.endLineNumber,
srcRange.endColumn + deltaColumn,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ suite('Editor Contrib - Block Comment Command', () => {
],
new Selection(1, 3, 1, 3),
[
'fi<00>rst',
'fi<0 0>rst',
'\tsecond line',
'third line',
'fourth line',
'fifth'
],
new Selection(1, 5, 1, 5)
new Selection(1, 6, 1, 6)
);
});

Expand All @@ -49,13 +49,13 @@ suite('Editor Contrib - Block Comment Command', () => {
],
new Selection(2, 1, 1, 1),
[
'<0first',
'0>\tsecond line',
'<0 first',
' 0>\tsecond line',
'third line',
'fourth line',
'fifth'
],
new Selection(1, 3, 2, 1)
new Selection(1, 4, 2, 1)
);
});

Expand All @@ -70,13 +70,13 @@ suite('Editor Contrib - Block Comment Command', () => {
],
new Selection(1, 6, 1, 1),
[
'<0first0>',
'<0 first 0>',
'\tsecond line',
'third line',
'fourth line',
'fifth'
],
new Selection(1, 3, 1, 8)
new Selection(1, 4, 1, 9)
);

testBlockCommentCommand(
Expand Down Expand Up @@ -110,13 +110,13 @@ suite('Editor Contrib - Block Comment Command', () => {
],
new Selection(1, 6, 1, 3),
[
'fi<0rst0>',
'fi<0 rst 0>',
'\tsecond line',
'third line',
'fourth line',
'fifth'
],
new Selection(1, 5, 1, 8)
new Selection(1, 6, 1, 9)
);
});

Expand All @@ -131,13 +131,13 @@ suite('Editor Contrib - Block Comment Command', () => {
],
new Selection(1, 6, 1, 3),
[
'fi<0rst0>',
'fi<0 rst 0>',
'\tsecond line',
'third line',
'fourth line',
'fifth'
],
new Selection(1, 5, 1, 8)
new Selection(1, 6, 1, 9)
);

testBlockCommentCommand(
Expand Down Expand Up @@ -171,13 +171,13 @@ suite('Editor Contrib - Block Comment Command', () => {
],
new Selection(2, 4, 1, 1),
[
'<0first',
'\tse0>cond line',
'<0 first',
'\tse 0>cond line',
'third line',
'fourth line',
'fifth'
],
new Selection(1, 3, 2, 4)
new Selection(1, 4, 2, 4)
);
});

Expand All @@ -192,13 +192,13 @@ suite('Editor Contrib - Block Comment Command', () => {
],
new Selection(2, 4, 1, 1),
[
'<0first',
'\tse0>cond line',
'<0 first',
'\tse 0>cond line',
'third line',
'fourth line',
'fifth'
],
new Selection(1, 3, 2, 4)
new Selection(1, 4, 2, 4)
);

testBlockCommentCommand(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,13 +544,13 @@ suite('Editor Contrib - Line Comment As Block Comment', () => {
],
new Selection(1, 1, 1, 1),
[
'(first)',
'( first )',
'\tsecond line',
'third line',
'fourth line',
'fifth'
],
new Selection(1, 2, 1, 2)
new Selection(1, 3, 1, 3)
);
});

Expand Down Expand Up @@ -586,13 +586,13 @@ suite('Editor Contrib - Line Comment As Block Comment', () => {
],
new Selection(1, 1, 1, 1),
[
'(first)',
'( first )',
'\tsecond line',
'third line',
'fourth line',
'fifth'
],
new Selection(1, 2, 1, 2)
new Selection(1, 3, 1, 3)
);
});

Expand All @@ -607,13 +607,13 @@ suite('Editor Contrib - Line Comment As Block Comment', () => {
],
new Selection(3, 2, 1, 3),
[
'(first',
'( first',
'\tsecond line',
'third line)',
'third line )',
'fourth line',
'fifth'
],
new Selection(1, 4, 3, 2)
new Selection(1, 5, 3, 2)
);

testLineCommentCommand(
Expand Down Expand Up @@ -655,7 +655,7 @@ suite('Editor Contrib - Line Comment As Block Comment 2', () => {
],
new Selection(1, 1, 1, 1),
[
'\t\t<!@#first\t #@!>',
'\t\t<!@# first\t #@!>',
'\t\tsecond line',
'\tthird line',
'fourth line',
Expand Down Expand Up @@ -809,8 +809,8 @@ suite('Editor Contrib - Line Comment As Block Comment 2', () => {
],
new Selection(1, 1, 3, 1),
[
' <!@#asd qwe',
' asd qwe#@!>',
' <!@# asd qwe',
' asd qwe #@!>',
''
],
new Selection(1, 1, 3, 1)
Expand Down Expand Up @@ -927,13 +927,13 @@ suite('Editor Contrib - Line Comment in mixed modes', () => {
[
'import React from \'react\';',
'const Loader = () => (',
' {/*<div>*/}',
' {/* <div> */}',
' Loading...',
' </div>',
');',
'export default Loader;'
],
new Selection(3, 7, 3, 7),
new Selection(3, 8, 3, 8),
);
});

Expand Down