-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Cursor appears before decoration on empty lines #40127
Comments
@nicksnyder does GitLens always display the annotations chopped like that (where the heatmap is going through the date)? |
@eamodio it looks like a bug with gitlens. Filed gitkraken/vscode-gitlens#228 Broken configuration:
Working configuration
You should be able to reproduce (the screencap is from mainThreadStorage.ts in vscode). |
(even with a working configuration, the issue I reported here still exists) |
@nicksnyder thanks! |
Here is the extension I've tried with (which works for me):
{
"publisher": "alex",
"name": "40127",
"version": "0.0.0",
"engines": {
"vscode": "^1.0.0"
},
"activationEvents": [
"*"
],
"main": "index.js"
}
const vscode = require('vscode');
exports.activate = function () {
var dectype = vscode.window.createTextEditorDecorationType({
before: {
contentText: "1234567890",
color: "#ff0000"
}
});
vscode.window.activeTextEditor.setDecorations(dectype, [
new vscode.Range(0, 0, 0, 0),
new vscode.Range(1, 0, 1, 0),
new vscode.Range(2, 0, 2, 0),
new vscode.Range(3, 0, 3, 0),
new vscode.Range(4, 0, 4, 0),
new vscode.Range(5, 0, 5, 0),
new vscode.Range(6, 0, 6, 0),
new vscode.Range(7, 0, 7, 0),
new vscode.Range(8, 0, 8, 0),
new vscode.Range(9, 0, 9, 0),
]);
} @eamodio Do these lines get both before and after inline decorations ? |
@alexandrudima yeah, if you have the inline blame turned on, the selected line will also get an after at the end of the line. |
To verify:
{
"publisher": "alex",
"name": "40127",
"version": "0.0.0",
"engines": {
"vscode": "^1.0.0"
},
"activationEvents": [
"*"
],
"main": "index.js"
}
const vscode = require('vscode');
exports.activate = function () {
const dectype1 = vscode.window.createTextEditorDecorationType({
before: {
contentText: "1234567890",
color: "#ff0000"
}
});
vscode.window.activeTextEditor.setDecorations(dectype1, [
new vscode.Range(0, 0, 0, 0),
new vscode.Range(1, 0, 1, 0),
new vscode.Range(2, 0, 2, 0),
new vscode.Range(3, 0, 3, 0),
new vscode.Range(4, 0, 4, 0),
new vscode.Range(5, 0, 5, 0),
new vscode.Range(6, 0, 6, 0),
new vscode.Range(7, 0, 7, 0),
new vscode.Range(8, 0, 8, 0),
new vscode.Range(9, 0, 9, 0),
]);
const dectype2 = vscode.window.createTextEditorDecorationType({
after: {
contentText: "abcd",
color: "#00ff00"
}
});
vscode.window.activeTextEditor.setDecorations(dectype2, [
new vscode.Range(0, 1000, 0, 1000),
new vscode.Range(1, 1000, 1, 1000),
new vscode.Range(2, 1000, 2, 1000),
new vscode.Range(3, 1000, 3, 1000),
new vscode.Range(4, 1000, 4, 1000),
new vscode.Range(5, 1000, 5, 1000),
new vscode.Range(6, 1000, 6, 1000),
new vscode.Range(7, 1000, 7, 1000),
new vscode.Range(8, 1000, 8, 1000),
new vscode.Range(9, 1000, 9, 1000),
]);
} Have an empty line at the beginning of the file. The cursor and the indent guides should render precisely between the before and the after decoration: |
Extensions like Gitlens register a decoration that appears before each line.
For lines that have content in them, everything works as expected: if you click on the decoration the cursor is placed at the beginning of the line AFTER the decoration.
For lines that do not have any content, the cursor is place BEFORE the decoration. This behavior seems strange.
The text was updated successfully, but these errors were encountered: