Skip to content

Commit

Permalink
scope
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikMennen committed Jul 12, 2023
1 parent 23521ef commit 95c8256
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void RegisterLanguage(string id, string grammarPath, params string[] exte

public IRawGrammar GetGrammar(string scopeName)
{
var g = _availableLanguages.FirstOrDefault(x => x.Id == scopeName);
var g = _availableLanguages.FirstOrDefault(x => x.Id == scopeName.Split('.').Last());

if (g == null) return _defaultRegistryOptions.GetGrammar(scopeName);
using var s = new StreamReader(AssetLoader.Open(new Uri(g.GrammarPath)));
Expand Down Expand Up @@ -54,7 +54,8 @@ public ICollection<string> GetInjections(string scopeName)
public string GetScopeByLanguageId(string languageId)
{
var r = _availableLanguages.FirstOrDefault(x => x.Id == languageId);
return r?.Id ?? _defaultRegistryOptions.GetScopeByLanguageId(languageId);
if (r != null) return $"source.{r.Id}";
return _defaultRegistryOptions.GetScopeByLanguageId(languageId);
}

public IRawTheme GetDefaultTheme()
Expand Down
2 changes: 1 addition & 1 deletion src/OneWare.Verilog/VerilogModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public void RegisterTypes(IContainerRegistry containerRegistry)

public void OnInitialized(IContainerProvider containerProvider)
{
containerProvider.Resolve<ILanguageManager>().RegisterTextMateLanguage("source.verilog", "avares://OneWare.Verilog/Assets/verilog.tmLanguage.json", ".v");
containerProvider.Resolve<ILanguageManager>().RegisterTextMateLanguage("verilog", "avares://OneWare.Verilog/Assets/verilog.tmLanguage.json", ".v");
}
}
2 changes: 1 addition & 1 deletion src/OneWare.Vhdl/VhdlModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void RegisterTypes(IContainerRegistry containerRegistry)
public void OnInitialized(IContainerProvider containerProvider)
{
containerProvider.Resolve<IErrorService>().RegisterErrorSource("VHDL LS");
containerProvider.Resolve<ILanguageManager>().RegisterTextMateLanguage("source.vhdl", "avares://OneWare.Vhdl/Assets/vhdl.tmLanguage.json", ".vhd", ".vhdl");
containerProvider.Resolve<ILanguageManager>().RegisterTextMateLanguage("vhdl", "avares://OneWare.Vhdl/Assets/vhdl.tmLanguage.json", ".vhd", ".vhdl");
containerProvider.Resolve<ILanguageManager>().RegisterService(typeof(LanguageServiceVhdl),true, ".vhd", ".vhdl");
}
}

0 comments on commit 95c8256

Please sign in to comment.