diff --git a/EmmetVS/CommandHandlers/TabKeyCommandHandler.cs b/EmmetVS/CommandHandlers/TabKeyCommandHandler.cs index 496c5d8..6d6ff3f 100644 --- a/EmmetVS/CommandHandlers/TabKeyCommandHandler.cs +++ b/EmmetVS/CommandHandlers/TabKeyCommandHandler.cs @@ -42,7 +42,7 @@ public bool ExecuteCommand(TabKeyCommandArgs args, CommandExecutionContext execu { if (Keyboard.Modifiers == ModifierKeys.None) { - if (!GeneralOptions.Instance.Enable || !GeneralOptions.Instance.EnableAdvanced || !GeneralOptions.Instance.EnableTabKey) + if (!GeneralOptions.Instance.Enable || !GeneralOptions.Instance.EnableTabKey) return false; var docView = VS.Documents.GetActiveDocumentViewAsync().GetAwaiter().GetResult(); diff --git a/EmmetVS/Commands/ExpandAbbreviationCommand.cs b/EmmetVS/Commands/ExpandAbbreviationCommand.cs index efed3d8..3646cf4 100644 --- a/EmmetVS/Commands/ExpandAbbreviationCommand.cs +++ b/EmmetVS/Commands/ExpandAbbreviationCommand.cs @@ -33,7 +33,7 @@ protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) { try { - if (!GeneralOptions.Instance.Enable || !GeneralOptions.Instance.EnableAdvanced) + if (!GeneralOptions.Instance.Enable) return; var docView = await VS.Documents.GetActiveDocumentViewAsync(); diff --git a/EmmetVS/Commands/WrapWithAbbreviationCommand.cs b/EmmetVS/Commands/WrapWithAbbreviationCommand.cs index 359e1dd..75944aa 100644 --- a/EmmetVS/Commands/WrapWithAbbreviationCommand.cs +++ b/EmmetVS/Commands/WrapWithAbbreviationCommand.cs @@ -39,7 +39,7 @@ protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) { try { - if (!GeneralOptions.Instance.Enable || !GeneralOptions.Instance.EnableAdvanced) + if (!GeneralOptions.Instance.Enable) return; var docView = await VS.Documents.GetActiveDocumentViewAsync(); diff --git a/EmmetVS/EmmetVS.csproj b/EmmetVS/EmmetVS.csproj index 51109ce..64ab66d 100644 --- a/EmmetVS/EmmetVS.csproj +++ b/EmmetVS/EmmetVS.csproj @@ -149,24 +149,31 @@ PreserveNewest + true PreserveNewest + true PreserveNewest + true PreserveNewest + true PreserveNewest + true PreserveNewest + true PreserveNewest + true Designer @@ -202,7 +209,7 @@ compile; build; native; contentfiles; analyzers; buildtransitive - 1.0.0 + 1.0.1 True diff --git a/EmmetVS/Helpers/ExtensionInitializationHelper.cs b/EmmetVS/Helpers/ExtensionInitializationHelper.cs index fab4497..8a49981 100644 --- a/EmmetVS/Helpers/ExtensionInitializationHelper.cs +++ b/EmmetVS/Helpers/ExtensionInitializationHelper.cs @@ -5,6 +5,7 @@ using System.ComponentModel.Design; using System.IO; using System.Linq; +using System.Reflection; namespace EmmetVS.Helpers; @@ -19,15 +20,17 @@ internal static async Task CheckDefaultInstallationOptionsAsync() if (RuntimeOptions.Instance.DefaultValuesSet) return; - var htmlSnippets = JsonConvert.DeserializeObject>(File.ReadAllText(SnippetDefaults.HtmlSnippetsLocation) ?? string.Empty); - var cssSnippets = JsonConvert.DeserializeObject>(File.ReadAllText(SnippetDefaults.CssSnippetsLocation) ?? string.Empty); - var xslSnippets = JsonConvert.DeserializeObject>(File.ReadAllText(SnippetDefaults.XslSnippetsLocation) ?? string.Empty); + var assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - var htmlSupportedFileTypes = JsonConvert.DeserializeObject>(File.ReadAllText(SnippetDefaults.HtmlSupportedFileTypesLocation) ?? string.Empty); - var cssSupportedFileTypes = JsonConvert.DeserializeObject>(File.ReadAllText(SnippetDefaults.CssSupportedFileTypesLocation) ?? string.Empty); - var xslSupportedFileTypes = JsonConvert.DeserializeObject>(File.ReadAllText(SnippetDefaults.XslSupportedFileTypesLocation) ?? string.Empty); + var htmlSnippets = JsonConvert.DeserializeObject>(File.ReadAllText(Path.Combine(assemblyPath, SnippetDefaults.HtmlSnippetsLocation)) ?? string.Empty); + var cssSnippets = JsonConvert.DeserializeObject>(File.ReadAllText(Path.Combine(assemblyPath, SnippetDefaults.CssSnippetsLocation)) ?? string.Empty); + var xslSnippets = JsonConvert.DeserializeObject>(File.ReadAllText(Path.Combine(assemblyPath, SnippetDefaults.XslSnippetsLocation)) ?? string.Empty); - var variables = JsonConvert.DeserializeObject>(File.ReadAllText(SnippetDefaults.VariablesLocation) ?? string.Empty); + var htmlSupportedFileTypes = JsonConvert.DeserializeObject>(File.ReadAllText(Path.Combine(assemblyPath, SnippetDefaults.HtmlSupportedFileTypesLocation)) ?? string.Empty); + var cssSupportedFileTypes = JsonConvert.DeserializeObject>(File.ReadAllText(Path.Combine(assemblyPath, SnippetDefaults.CssSupportedFileTypesLocation)) ?? string.Empty); + var xslSupportedFileTypes = JsonConvert.DeserializeObject>(File.ReadAllText(Path.Combine(assemblyPath, SnippetDefaults.XslSupportedFileTypesLocation)) ?? string.Empty); + + var variables = JsonConvert.DeserializeObject>(File.ReadAllText(Path.Combine(assemblyPath, SnippetDefaults.VariablesLocation)) ?? string.Empty); if (htmlSnippets is not null && htmlSnippets.Any()) { diff --git a/EmmetVS/Snippets/SnippetDefaults.cs b/EmmetVS/Snippets/SnippetDefaults.cs index 9318750..3d71735 100644 --- a/EmmetVS/Snippets/SnippetDefaults.cs +++ b/EmmetVS/Snippets/SnippetDefaults.cs @@ -1,4 +1,6 @@ -namespace EmmetVS.Snippets; +using System.IO; + +namespace EmmetVS.Snippets; /// /// Represents the snippet locations @@ -13,35 +15,35 @@ public static class SnippetDefaults /// /// Gets the HTML snippets file location /// - public static string HtmlSnippetsLocation = $"{SnippetsDirectory}/html-snippets.json"; + public static string HtmlSnippetsLocation = Path.Combine(SnippetsDirectory, "html-snippets.json"); /// /// Gets the HTML supported file types file location /// - public static string HtmlSupportedFileTypesLocation = $"{SnippetsDirectory}/html-supported-file-types.json"; + public static string HtmlSupportedFileTypesLocation = Path.Combine(SnippetsDirectory, "html-supported-file-types.json"); /// /// Gets the CSS snippets file location /// - public static string CssSnippetsLocation = $"{SnippetsDirectory}/css-snippets.json"; + public static string CssSnippetsLocation = Path.Combine(SnippetsDirectory, "css-snippets.json"); /// /// Gets the CSS supported file types file location /// - public static string CssSupportedFileTypesLocation = $"{SnippetsDirectory}/css-supported-file-types.json"; + public static string CssSupportedFileTypesLocation = Path.Combine(SnippetsDirectory, "css-supported-file-types.json"); /// /// Gets the XSL snippets file location /// - public static string XslSnippetsLocation = $"{SnippetsDirectory}/xsl-snippets.json"; + public static string XslSnippetsLocation = Path.Combine(SnippetsDirectory, "xsl-snippets.json"); /// /// Gets the XSL supported file types file location /// - public static string XslSupportedFileTypesLocation = $"{SnippetsDirectory}/xsl-supported-file-types.json"; + public static string XslSupportedFileTypesLocation = Path.Combine(SnippetsDirectory, "xsl-supported-file-types.json"); /// /// Gets the variables file location /// - public static string VariablesLocation = $"{SnippetsDirectory}/variables.json"; + public static string VariablesLocation = Path.Combine(SnippetsDirectory, "variables.json"); } diff --git a/EmmetVS/source.extension.cs b/EmmetVS/source.extension.cs index 10442d9..faea659 100644 --- a/EmmetVS/source.extension.cs +++ b/EmmetVS/source.extension.cs @@ -11,7 +11,7 @@ internal sealed partial class Vsix public const string Name = "EmmetVS"; public const string Description = @"Supercharge your Visual Studio environment with the power of Emmet! Effortlessly expand abbreviations into complex HTML/XML and CSS code snippets. Streamline your web development process and elevate your coding efficiency like never before."; public const string Language = "en-US"; - public const string Version = "1.0.0"; + public const string Version = "1.0.1"; public const string Author = "Amadej Glasenčnik"; public const string Tags = "visual-studio, vsix, emmet, html, css, xml, snippets, tools"; } diff --git a/EmmetVS/source.extension.vsixmanifest b/EmmetVS/source.extension.vsixmanifest index 0093fa7..129511a 100644 --- a/EmmetVS/source.extension.vsixmanifest +++ b/EmmetVS/source.extension.vsixmanifest @@ -1,7 +1,7 @@  - + EmmetVS Supercharge your Visual Studio environment with the power of Emmet! Effortlessly expand abbreviations into complex HTML/XML and CSS code snippets. Streamline your web development process and elevate your coding efficiency like never before. https://github.com/aglasencnik/EmmetVS