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

Adopt injected text infrastructure for other features #132537

Closed
7 of 8 tasks
hediet opened this issue Sep 7, 2021 · 3 comments
Closed
7 of 8 tasks

Adopt injected text infrastructure for other features #132537

hediet opened this issue Sep 7, 2021 · 3 comments
Assignees
Labels
debt Code quality issues
Milestone

Comments

@hediet
Copy link
Member

hediet commented Sep 7, 2021

Users of IModelDecorationOptions.beforeContentClassName or IModelDecorationOptions.afterContentClassName:


Users of IThemeDecorationRenderOptions.before or IThemeDecorationRenderOptions.after:


Users of IThemeDecorationRenderOptions.beforeInjectedText or IThemeDecorationRenderOptions.afterInjectedText:


Users of IThemeDecorationInstanceRenderOptions.after:


Sample showing how we could render a color box:

image

var jsCode = [
  '"use strict";',
  "function Person(age) {",
  "	if (age) {",
  "		this.age = age;",
  "	}",
  "}",
  "Person.prototype.getAge = function () {",
  "	return this.age;",
  "};",
].join("\n");

var editor = monaco.editor.create(document.getElementById("container"), {
  value: jsCode,
  language: "javascript",
});

var decorations = editor.deltaDecorations(
  [],
  [
    {
      range: new monaco.Range(3, 6, 3, 7),
      options: {
        after: {
          content: " ",
          inlineClassName: "special-box",
          inlineClassNameAffectsLetterSpacing: true,
        }
      }
    }
  ]
);
.special-box {
  border: solid 0.1em #000;
  box-sizing: border-box;
  margin: 0.1em 0.2em 0 0.2em;
  width: 0.8em;
  height: 0.8em;
  background-color:red;
  line-height: 0.8em;
  display: inline-block;
}
@hediet hediet added the feature-request Request for new features or functionality label Sep 7, 2021
@hediet hediet added this to the September 2021 milestone Sep 7, 2021
@hediet hediet self-assigned this Sep 7, 2021
@Tyriar
Copy link
Member

Tyriar commented Sep 7, 2021

@hediet can you clarify what other features will be looked at for this?

@hediet
Copy link
Member Author

hediet commented Sep 7, 2021

Mainly the test explorer I think.

The scope of this issue is flexible and part of it is figuring out where injected text makes sense (instead of before/after css text).

@hediet hediet modified the milestones: September 2021, October 2021 Sep 30, 2021
@hediet hediet modified the milestones: October 2021, November 2021 Oct 28, 2021
@hediet hediet mentioned this issue Nov 2, 2021
12 tasks
@alexdima alexdima changed the title Adopt new injected text infrastructure for other features that inject text Reduce usages of ::before and ::after in the editor Nov 4, 2021
@alexdima alexdima self-assigned this Nov 4, 2021
@alexdima alexdima changed the title Reduce usages of ::before and ::after in the editor Adopt injected text infrastructure for other features Nov 4, 2021
@hediet hediet linked a pull request Nov 8, 2021 that will close this issue
@hediet
Copy link
Member Author

hediet commented Nov 9, 2021

renders ⋯ at end of folded lines

Injected text semantics currently do not make much sense for : There would be a cursor stop both to the right and to the left and the symbol would word-wrap separately.

Alex thoughts:

but maybe it’s the line wrapping algorithm that should not break before this specific injected text
the problem with the current implementation is that the … is not accounted for when wrapping, so you will get a horizontal scrollbar which also is bad

We decided to adopt injected text for at a later point, possibly together with enhancing the feature to support { ⋯ }.

@hediet hediet closed this as completed Nov 9, 2021
@hediet hediet removed a link to a pull request Nov 10, 2021
@alexdima alexdima removed their assignment Nov 11, 2021
@hediet hediet added debt Code quality issues and removed feature-request Request for new features or functionality labels Nov 30, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Dec 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debt Code quality issues
Projects
None yet
Development

No branches or pull requests

3 participants