mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
code_style: remove all IDE warnings
This commit is contained in:
parent
24ca3eaf8c
commit
f4eca45754
79 changed files with 1462 additions and 1378 deletions
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
using Avalonia;
|
||||
using Avalonia.Styling;
|
||||
|
||||
using AvaloniaEdit;
|
||||
|
@ -14,14 +15,10 @@ namespace SourceGit.Models
|
|||
{
|
||||
public static TextMate.Installation CreateForEditor(TextEditor editor)
|
||||
{
|
||||
if (App.Current?.ActualThemeVariant == ThemeVariant.Dark)
|
||||
{
|
||||
if (Application.Current?.ActualThemeVariant == ThemeVariant.Dark)
|
||||
return editor.InstallTextMate(new RegistryOptions(ThemeName.DarkPlus));
|
||||
}
|
||||
else
|
||||
{
|
||||
return editor.InstallTextMate(new RegistryOptions(ThemeName.LightPlus));
|
||||
}
|
||||
|
||||
return editor.InstallTextMate(new RegistryOptions(ThemeName.LightPlus));
|
||||
}
|
||||
|
||||
public static void SetThemeByApp(TextMate.Installation installation)
|
||||
|
@ -29,35 +26,28 @@ namespace SourceGit.Models
|
|||
if (installation == null)
|
||||
return;
|
||||
|
||||
var reg = installation.RegistryOptions as RegistryOptions;
|
||||
if (App.Current?.ActualThemeVariant == ThemeVariant.Dark)
|
||||
if (installation.RegistryOptions is RegistryOptions reg)
|
||||
{
|
||||
installation.SetTheme(reg.LoadTheme(ThemeName.DarkPlus));
|
||||
}
|
||||
else
|
||||
{
|
||||
installation.SetTheme(reg.LoadTheme(ThemeName.LightPlus));
|
||||
if (Application.Current?.ActualThemeVariant == ThemeVariant.Dark)
|
||||
installation.SetTheme(reg.LoadTheme(ThemeName.DarkPlus));
|
||||
else
|
||||
installation.SetTheme(reg.LoadTheme(ThemeName.LightPlus));
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetGrammarByFileName(TextMate.Installation installation, string filePath)
|
||||
{
|
||||
if (installation == null)
|
||||
return;
|
||||
|
||||
var ext = Path.GetExtension(filePath);
|
||||
if (ext == ".h")
|
||||
if (installation is { RegistryOptions: RegistryOptions reg })
|
||||
{
|
||||
ext = ".cpp";
|
||||
}
|
||||
else if (ext == ".resx" || ext == ".plist")
|
||||
{
|
||||
ext = ".xml";
|
||||
}
|
||||
var ext = Path.GetExtension(filePath);
|
||||
if (ext == ".h")
|
||||
ext = ".cpp";
|
||||
else if (ext == ".resx" || ext == ".plist")
|
||||
ext = ".xml";
|
||||
|
||||
var reg = installation.RegistryOptions as RegistryOptions;
|
||||
installation.SetGrammar(reg.GetScopeByExtension(ext));
|
||||
GC.Collect();
|
||||
installation.SetGrammar(reg.GetScopeByExtension(ext));
|
||||
GC.Collect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue