aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2023-02-14 12:30:06 +0100
committerKarsten Heimrich <karsten.heimrich@qt.io>2023-02-23 14:30:09 +0000
commitd3359954271b5e64b2fe9f3c456fbe2578dbbc49 (patch)
tree8ad595d8d97daf0de5b359b3404e121191b081de
parent64e23d2dc117454c5827f3ee2a60c4d8496adac4 (diff)
Cleanup TextMate Language Grammar file handling
There is no UI option available to set value of useQtTmLanguage, so we always copy the .pri/.pro TextMate Language Grammar file. Combine this into a single function and remove the superfluous settings read. Change-Id: I90b2e5ebcafbd53536396c370cecc477753078e4 Reviewed-by: Miguel Costa <miguel.costa@qt.io>
-rw-r--r--QtVsTools.Package/QtVsToolsPackage.cs42
1 files changed, 10 insertions, 32 deletions
diff --git a/QtVsTools.Package/QtVsToolsPackage.cs b/QtVsTools.Package/QtVsToolsPackage.cs
index 6ab3be0c..e0707727 100644
--- a/QtVsTools.Package/QtVsToolsPackage.cs
+++ b/QtVsTools.Package/QtVsToolsPackage.cs
@@ -35,10 +35,8 @@ using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio;
-using Microsoft.VisualStudio.Settings;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
-using Microsoft.VisualStudio.Shell.Settings;
using Microsoft.VisualStudio.Threading;
using Microsoft.Win32;
using EnvDTE;
@@ -140,15 +138,9 @@ namespace QtVsTools
const string urlDownloadQtIo = "https://download.qt.io/development_releases/vsaddin/";
private DteEventsHandler eventHandler;
- private bool useQtTmLanguage;
- private string qtTmLanguagePath;
private string visualizersPath;
- public QtVsToolsPackage()
- {
- }
-
protected override async Task InitializeAsync(
CancellationToken cancellationToken,
IProgress<ServiceProgressData> progress)
@@ -187,7 +179,6 @@ namespace QtVsTools
if (!string.IsNullOrEmpty(VsShell.InstallRootDir))
HelperFunctions.VCPath = Path.Combine(VsShell.InstallRootDir, "VC");
- GetTextMateLanguagePath();
GetNatvisPath();
///////////////////////////////////////////////////////////////////////////////////
@@ -346,31 +337,18 @@ namespace QtVsTools
return base.QueryClose(out canClose);
}
- private void GetTextMateLanguagePath()
- {
- var settingsManager = new ShellSettingsManager(this as System.IServiceProvider);
- var store = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings);
- useQtTmLanguage = store.GetBoolean(@"QtVsTools\Qml\TextMate", @"Enable", true);
- qtTmLanguagePath = Environment.
- ExpandEnvironmentVariables("%USERPROFILE%\\.vs\\Extensions\\qttmlanguage");
- }
-
private void CopyTextMateLanguageFiles()
{
- if (useQtTmLanguage) {
- HelperFunctions.CopyDirectory(Path.Combine(PkgInstallPath, "qttmlanguage"),
- qtTmLanguagePath);
- } else {
- Directory.Delete(qtTmLanguagePath, true);
- }
-
- //Remove textmate-based QML syntax highlighting
- var qmlTextmate = Path.Combine(qtTmLanguagePath, "qml");
- if (Directory.Exists(qmlTextmate)) {
- try {
- Directory.Delete(qmlTextmate, true);
- } catch { }
- }
+ var qtTmLanguagePath = Environment.
+ ExpandEnvironmentVariables("%USERPROFILE%\\.vs\\Extensions\\qttmlanguage");
+ HelperFunctions.CopyDirectory(Path.Combine(PkgInstallPath, "qttmlanguage"),
+ qtTmLanguagePath); // always copy .pri/.pro TextMate Language Grammar file
+
+ try { //Remove TextMate-based QML syntax highlighting
+ var qmlTextMate = Path.Combine(qtTmLanguagePath, "qml");
+ if (Directory.Exists(qmlTextMate))
+ Directory.Delete(qmlTextMate, true);
+ } catch {}
}
private void CopyNatvisFile(string filename, string qtNamespace)