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

fix: theme associations not working anymore #685

Merged
merged 1 commit into from
Feb 5, 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
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@
package org.eclipse.tm4e.registry;

import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tm4e.registry.internal.TMScope;

/**
* TextMate grammar scope API
*/
public interface ITMScope {

/**
* @param scopeName fully qualified ("[email protected]") or unqualified scopeName ("source.batchfile")
*/
static ITMScope parse(String scopeName) {
return TMScope.parse(scopeName);
}

String getName();

String getQualifiedName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.tm4e.registry.ITMScope;
import org.eclipse.tm4e.ui.internal.utils.PreferenceUtils;
import org.eclipse.tm4e.ui.themes.ITheme;
import org.eclipse.tm4e.ui.themes.IThemeAssociation;
Expand Down Expand Up @@ -87,7 +88,9 @@ public boolean isDarkEclipseTheme(@Nullable final String eclipseThemeId) {
}

@Override
public ITheme getThemeForScope(final String scopeName, final boolean dark) {
public ITheme getThemeForScope(String scopeName, final boolean dark) {
scopeName = ITMScope.parse(scopeName).getName();

final IThemeAssociation association = themeAssociationRegistry.getThemeAssociationFor(scopeName, dark);
if (association != null) {
final String themeId = association.getThemeId();
Expand All @@ -105,7 +108,9 @@ public ITheme getThemeForScope(final String scopeName) {
}

@Override
public IThemeAssociation[] getThemeAssociationsForScope(final String scopeName) {
public IThemeAssociation[] getThemeAssociationsForScope(String scopeName) {
scopeName = ITMScope.parse(scopeName).getName();

final var associations = new ArrayList<IThemeAssociation>();
IThemeAssociation light = themeAssociationRegistry.getThemeAssociationFor(scopeName, false);
if (light == null) {
Expand Down