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

Semantic Tokens: Do not use default theme #1029

Merged
merged 2 commits into from
Jun 21, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion org.eclipse.lsp4e.test/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tests for language server bundle (Incubation)
Bundle-SymbolicName: org.eclipse.lsp4e.test;singleton:=true
Bundle-Version: 0.15.13.qualifier
Bundle-Version: 0.15.14.qualifier
Fragment-Host: org.eclipse.lsp4e
Bundle-Vendor: Eclipse.org
Bundle-RequiredExecutionEnvironment: JavaSE-17
Expand Down
30 changes: 30 additions & 0 deletions org.eclipse.lsp4e.test/fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
contentType="org.eclipse.lsp4e.test.content-type"
id="org.eclipse.lsp4e.test.server">
</contentTypeMapping>
<contentTypeMapping
contentType="org.eclipse.lsp4e.test.content-type.tm"
id="org.eclipse.lsp4e.test.server">
</contentTypeMapping>
<contentTypeMapping
contentType="org.eclipse.lsp4e.test.content-type-multi-ls"
id="org.eclipse.lsp4e.test.server">
Expand Down Expand Up @@ -125,6 +129,13 @@
id="org.eclipse.lsp4e.test.content-type"
name="Test Content Type"
priority="normal">
</content-type>
<content-type
base-type="org.eclipse.core.runtime.text"
file-extensions="lsptm"
id="org.eclipse.lsp4e.test.content-type.tm"
name="Test Content Type With TM Grammar"
priority="normal">
</content-type>
<content-type
base-type="org.eclipse.core.runtime.text"
Expand Down Expand Up @@ -277,4 +288,23 @@
class="org.eclipse.lsp4e.test.references.FindReferencesTest$UiFreezeEventLogger">
</logger>
</extension>

<extension
point="org.eclipse.tm4e.registry.grammars">
<grammar
path="org/eclipse/lsp4e/test/semanticTokens/rust.tmLanguage.json"
scopeName="source.lsptm">
</grammar>
<scopeNameContentTypeBinding
contentTypeId="org.eclipse.lsp4e.test.content-type.tm"
scopeName="source.lsptm">
</scopeNameContentTypeBinding>
</extension>
<extension
point="org.eclipse.ui.genericeditor.presentationReconcilers">
<presentationReconciler
class="org.eclipse.tm4e.ui.text.TMPresentationReconciler"
contentType="org.eclipse.lsp4e.test.content-type.tm">
</presentationReconciler>
</extension>
</fragment>
2 changes: 1 addition & 1 deletion org.eclipse.lsp4e.test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</parent>
<artifactId>org.eclipse.lsp4e.test</artifactId>
<packaging>eclipse-test-plugin</packaging>
<version>0.15.13-SNAPSHOT</version>
<version>0.15.14-SNAPSHOT</version>

<properties>
<os-jvm-flags /> <!-- for the default case -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void testKeyword() throws CoreException {

MockLanguageServer.INSTANCE.getTextDocumentService().setSemanticTokens(semanticTokens);

IFile file = TestUtils.createUniqueTestFile(project, "lspt", SemanticTokensTestUtil.keywordText);
IFile file = TestUtils.createUniqueTestFile(project, "lsptm", SemanticTokensTestUtil.keywordText);
ITextViewer textViewer = TestUtils.openTextViewer(file);

Display display = shell.getDisplay();
Expand All @@ -58,18 +58,30 @@ public void testKeyword() throws CoreException {
StyleRange[] styleRanges = textViewer.getTextWidget().getStyleRanges();
var backgroundColor = textViewer.getTextWidget().getBackground();

assertEquals(3, styleRanges.length);
assertEquals(6, styleRanges.length);

assertEquals(0, styleRanges[0].start);
assertEquals(4, styleRanges[0].length);
assertNotEquals(styleRanges[0].foreground, backgroundColor);

assertEquals(15, styleRanges[1].start);
assertEquals(4, styleRanges[1].length);
assertEquals(4, styleRanges[1].start);
assertEquals(11, styleRanges[1].length);
assertNotEquals(styleRanges[1].foreground, backgroundColor);

assertEquals(24, styleRanges[2].start);
assertEquals(7, styleRanges[2].length);
assertEquals(15, styleRanges[2].start);
assertEquals(4, styleRanges[2].length);
assertNotEquals(styleRanges[2].foreground, backgroundColor);

assertEquals(19, styleRanges[3].start);
assertEquals(5, styleRanges[3].length);
assertNotEquals(styleRanges[3].foreground, backgroundColor);

assertEquals(24, styleRanges[4].start);
assertEquals(7, styleRanges[4].length);
assertNotEquals(styleRanges[4].foreground, backgroundColor);

assertEquals(31, styleRanges[5].start);
assertEquals(11, styleRanges[5].length);
assertNotEquals(styleRanges[5].foreground, backgroundColor);
}
}
Loading
Loading