Finalize boot-hint optics change

This commit is contained in:
BoykoAlex
2018-08-01 15:28:13 -04:00
parent cc756ba2d4
commit 819ae52acf
12 changed files with 11 additions and 61 deletions

View File

@@ -8,10 +8,9 @@ const BOOT_HINT_GUTTER_NAME = 'boot-hint-gutter';
const DECORATION_OPTIONS: DecorationOptions = {
type: 'highlight',
class: 'boot-hint',
// gutterName: BOOT_HINT_GUTTER_NAME
gutterName: BOOT_HINT_GUTTER_NAME
};
export class BootStsAdapter extends StsAdapter {
constructor() {
@@ -24,10 +23,6 @@ export class BootStsAdapter extends StsAdapter {
private markHintsForEditor(editor: TextEditor, ranges: Range[]) {
editor.getDecorations(DECORATION_OPTIONS).map(decoration => decoration.getMarker()).forEach(m => m.destroy());
editor.getDecorations({
type: 'block',
class: 'boot-hint-icon'
}).map(decoration => decoration.getMarker()).forEach(m => m.destroy());
if (Array.isArray(ranges)) {
ranges.forEach(range => this.createHintMarker(editor, range));
}
@@ -42,30 +37,12 @@ export class BootStsAdapter extends StsAdapter {
}
private createHintMarker(editor: TextEditor, range: Range) {
// Create marker model
const marker = editor.markBufferRange(Convert.lsRangeToAtomRange(range));
// Marker around the text in the editor
editor.decorateMarker(marker, DECORATION_OPTIONS);
const element = document.createElement('img');
// element.textContent = '🐲';
element.src = 'atom://spring-boot/styles/boot-icon.png';
const AUX_DECORATION_OPTIONS: DecorationOptions = {
type: 'block',
position: 'before',
item: element,
class: 'boot-hint-icon'
};
const auxMarker = editor.markBufferRange(Convert.lsRangeToAtomRange({
start: range.start,
end: range.start
}));
editor.decorateMarker(auxMarker, AUX_DECORATION_OPTIONS);
// Marker in the diagnostic gutter
let gutter = editor.gutterWithName(BOOT_HINT_GUTTER_NAME);
if (!gutter) {

View File

@@ -3,27 +3,11 @@
border-color: rgba(109,179,63,0.25);
border-radius: 4px;
border-spacing: 4px;
//border-color: #32BA56;
//border-style: dotted;
//border-width: 1px;
}
.boot-hint-icon {
//background-image: url("atom://spring-boot/styles/boot-icon.png");
//width: 10px;
//height: 10px;
display: inline;
}
//.boot-hint .region::before {
// content: url("atom://spring-boot/styles/boot-icon.png");
// display: block;
//}
//before: {
// contentIconPath: path.resolve(__dirname, "../icons/boot-12.png"),
// margin: '0px 2px 0px 0px',
// height: '18pt'
//},
atom-text-editor.editor {
.gutter-boot-hint:before {
content: url("atom://spring-boot/styles/boot-icon.png");

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -39,7 +39,7 @@ public class BootInlineAnnotation extends LineContentAnnotation {
FontMetrics fontMetrics = gc.getFontMetrics();
int height = fontMetrics.getHeight();
Image bootImage = LanguageServerCommonsActivator.getInstance().getImageRegistry().get(LanguageServerCommonsActivator.BOOT_ICON_2X_KEY);
Image bootImage = LanguageServerCommonsActivator.getInstance().getImageRegistry().get(LanguageServerCommonsActivator.BOOT_KEY);
Rectangle bootImgBounds = bootImage.getBounds();
int width = (int) Math.round(bootImgBounds.width / (double) bootImgBounds.height * height);

View File

@@ -26,7 +26,7 @@ public class LanguageServerCommonsActivator extends AbstractUIPlugin {
public static final String PLUGIN_ID = "org.springframework.tooling.ls.eclipse.commons";
public static final String BOOT_ICON_2X_KEY = "boot-icon-key";
public static final String BOOT_KEY = "boot-key";
private static LanguageServerCommonsActivator instance;
@@ -37,7 +37,7 @@ public class LanguageServerCommonsActivator extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception {
instance = this;
super.start(context);
getImageRegistry().put(BOOT_ICON_2X_KEY, getImageDescriptor("icons/boot-icon@2x.png"));
getImageRegistry().put(BOOT_KEY, getImageDescriptor("icons/boot.png"));
}
public final static ImageDescriptor getImageDescriptor(String path) {

View File

@@ -188,7 +188,8 @@ public class STS4LanguageClientImpl extends LanguageClientImpl implements STS4La
for (Range rng : highlights) {
try {
int start = LSPEclipseUtils.toOffset(rng.getStart(), doc);
Position colorPos = new Position(start, 0);
int end = LSPEclipseUtils.toOffset(rng.getEnd(), doc);
Position colorPos = new Position(start, end - start);
BootInlineAnnotation colorAnnotation = support.findExistingAnnotation(colorPos);
if (colorAnnotation == null) {
colorAnnotation = new BootInlineAnnotation(colorPos, sourceViewer);

View File

@@ -4,4 +4,4 @@ set -e
-f ../pom.xml \
-pl spring-boot-language-server \
-am \
clean install -DskipTests
clean install

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -1,8 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="205.3" height="184.28" viewBox="0 0 205.3 184.28">
<defs>
<style>.a{fill:#68bd45;}</style>
</defs>
<title>Asset 1</title>
<path class="a"
d="M202.66,81.08l-40.43-70C158.72,5,150.1,0,143.08,0H62.22c-7,0-15.64,5-19.15,11.06l-40.43,70c-3.52,6.08-3.52,16,0,22.12l40.43,70c3.51,6.08,12.13,11.06,19.15,11.06h80.86c7,0,15.63-5,19.15-11.06l40.43-70C206.18,97.11,206.18,87.17,202.66,81.08ZM93.91,38.72a8.34,8.34,0,1,1,16.67,0V88.53a8.34,8.34,0,1,1-16.67,0ZM102.25,145A56.51,56.51,0,0,1,68.54,43.17a7.41,7.41,0,1,1,8.85,11.89,41.69,41.69,0,1,0,66.54,33.47A41.89,41.89,0,0,0,127,55,7.41,7.41,0,0,1,135.76,43a56.52,56.52,0,0,1-33.51,102Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 716 B

View File

@@ -27,12 +27,8 @@ export class HighlightService {
constructor() {
this.DECORATION = VSCode.window.createTextEditorDecorationType({
// textDecoration: "underline",
// gutterIconPath: path.resolve(__dirname, "../icons/boot-icon.png"),
// gutterIconSize: "contain",
// outline: "#32BA56 dotted thin",
before: {
contentIconPath: path.resolve(__dirname, "../icons/boot-12.png"),
contentIconPath: path.resolve(__dirname, "../icons/boot-12h.png"),
margin: '2px 2px 0px 0px'
},
backgroundColor: 'rgba(109,179,63,0.25)',