From 3a6cededc6f61ebd093479de07fef3673214c261 Mon Sep 17 00:00:00 2001 From: Chuck Lau Date: Mon, 25 Dec 2023 00:12:07 +0800 Subject: [PATCH 1/3] Make ExtensionBaseUrl configurable. --- CodeiumVS/LanguageServer/LanguageServer.cs | 6 ++++-- CodeiumVS/SettingsPage.cs | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CodeiumVS/LanguageServer/LanguageServer.cs b/CodeiumVS/LanguageServer/LanguageServer.cs index a105a2c..afa2dec 100644 --- a/CodeiumVS/LanguageServer/LanguageServer.cs +++ b/CodeiumVS/LanguageServer/LanguageServer.cs @@ -3,6 +3,7 @@ using Microsoft.VisualStudio.Imaging; using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.Threading; +using Microsoft.Win32; using Newtonsoft.Json; using System.Collections.Generic; using System.ComponentModel; @@ -200,7 +201,8 @@ public async Task SignOutAsync() /// private async Task GetLanguageServerInfoAsync() { - string extensionBaseUrl = "https://github.com/Exafunction/codeium/releases/download"; + string extensionBaseUrl = (_package.SettingsPage.ExtensionBaseUrl.Equals("") ? "https://github.com/Exafunction/codeium/releases/download" + : _package.SettingsPage.ExtensionBaseUrl); if (_package.SettingsPage.EnterpriseMode) { @@ -393,7 +395,7 @@ public async Task PrepareAsync() } await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); - await _package.LogAsync($"Downloading language server v{_languageServerVersion}"); + await _package.LogAsync($"Downloading language server v{_languageServerVersion} from {_languageServerURL}"); // show the downloading progress dialog before starting the thread to make it feels more // responsive diff --git a/CodeiumVS/SettingsPage.cs b/CodeiumVS/SettingsPage.cs index a9b4fdf..8046d01 100644 --- a/CodeiumVS/SettingsPage.cs +++ b/CodeiumVS/SettingsPage.cs @@ -9,6 +9,7 @@ public class SettingsPage : DialogPage private bool enterpriseMode; private string portalUrl = ""; private string apiUrl = ""; + private string extensionBaseUrl = "https://github.com/Exafunction/codeium/releases/download"; private bool enableCommentCompletion = true; private bool enableLanguageServerProxy = false; @@ -39,6 +40,21 @@ public string PortalUrl } } + [Category("Codeium")] + [DisplayName("Extension Base Url")] + [Description("URL of the Codeium Extension Base.")] + public string ExtensionBaseUrl + { + get + { + return extensionBaseUrl; + } + set + { + extensionBaseUrl = value; + } + } + [Category("Codeium")] [DisplayName("API Url")] [Description("API Url for Codeium Enterprise. Requires restart.")] From 65d0cab29e6a72016e1b43c008260d44c7571863 Mon Sep 17 00:00:00 2001 From: Chuck Lau Date: Tue, 26 Dec 2023 14:58:44 +0800 Subject: [PATCH 2/3] Update CodeiumVS/SettingsPage.cs Co-authored-by: thedemons <17585270+thedemons@users.noreply.github.com> --- CodeiumVS/SettingsPage.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CodeiumVS/SettingsPage.cs b/CodeiumVS/SettingsPage.cs index 8046d01..dfea19f 100644 --- a/CodeiumVS/SettingsPage.cs +++ b/CodeiumVS/SettingsPage.cs @@ -41,8 +41,9 @@ public string PortalUrl } [Category("Codeium")] - [DisplayName("Extension Base Url")] - [Description("URL of the Codeium Extension Base.")] + [DisplayName("Language Server Download URL")] + [Description( + "If you're experiencing network issues with GitHub and can't download the language server, please change this to a GitHub Mirror URL instead. For example: https://gh.api.99988866.xyz/https://github.com/Exafunction/codeium/releases/download")] public string ExtensionBaseUrl { get From 960a4330aca2c10c4fa8b5261dfb5fff539405f7 Mon Sep 17 00:00:00 2001 From: Chuck Lau Date: Tue, 26 Dec 2023 14:59:08 +0800 Subject: [PATCH 3/3] Update CodeiumVS/LanguageServer/LanguageServer.cs Co-authored-by: thedemons <17585270+thedemons@users.noreply.github.com> --- CodeiumVS/LanguageServer/LanguageServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CodeiumVS/LanguageServer/LanguageServer.cs b/CodeiumVS/LanguageServer/LanguageServer.cs index afa2dec..fd70452 100644 --- a/CodeiumVS/LanguageServer/LanguageServer.cs +++ b/CodeiumVS/LanguageServer/LanguageServer.cs @@ -202,7 +202,7 @@ public async Task SignOutAsync() private async Task GetLanguageServerInfoAsync() { string extensionBaseUrl = (_package.SettingsPage.ExtensionBaseUrl.Equals("") ? "https://github.com/Exafunction/codeium/releases/download" - : _package.SettingsPage.ExtensionBaseUrl); + : _package.SettingsPage.ExtensionBaseUrl.Trim().TrimEnd('/')); if (_package.SettingsPage.EnterpriseMode) {