TerminalFi / LSP-copilot

GitHub Copilot support for Sublime Text LSP plugin provided through Copilot.vim.
658 stars 25 forks source link

Investigate how to supported dedicated Copilot Environments (Org Tenants) #114

Open TerminalFi opened 1 year ago

TerminalFi commented 1 year ago

At the Organization I work at, we are looking to use Copilot with a dedicated tenant. This begs the question, how can this be supported at the plugin level.

Will update here as I get more thoughts.

I am going to review the VS Code plugin and see if there is a missed setting for specifying tenant or how it may work

TerminalFi commented 1 year ago

Copilot has Advanced configurations. Here we can see that it checks the config setting of path advanced.authProvider

It looks for the value github-enterprise, if it matches it gets the value of uri else defaults to https://github.com

            61405: (e, t, n) => {
                "use strict";
                Object.defineProperty(t, "__esModule", { value: !0 }),
                    (t.onDidChangeConfigurationHandler = t.VSCodeNetworkConfiguration =
                        void 0);
                const r = n(89496),
                    i = n(44197),
                    o = n(42512),
                    s = n(30047),
                    a = "github-enterprise",
                    c = "https://github.com";
                function l() {
                    return r.workspace
                        .getConfiguration(i.CopilotConfigPrefix)
                        .get("advanced")?.authProvider === s.AuthProviderId.GitHubEnterprise
                        ? ra.workspace.getConfiguration(a).get("uri") ?? c
                        : c;
                }
timfjord commented 1 year ago

I guess we could use the project settings(*sublime-project) for that

TerminalFi commented 1 year ago

I think we can have it at both locations. Main settings and project level settings. I am working to update this today as I start testing. I think it is pretty straight forward in that we only need these settings present and no other changes are required.

raffeyang commented 6 months ago

Any plan to release this update, reference VS Code. I think it's easy to add some config like:

 "github.copilot.advanced": {
    "authProvider": "github-enterprise",
},
"github-enterprise.uri": "",
jfcherng commented 6 months ago

Any plan to release this update, reference VS Code. I think it's easy to add some config like:

 "github.copilot.advanced": {
    "authProvider": "github-enterprise",
},
"github-enterprise.uri": "",

Feel free a create a PR if in your test, it's just to add a config to make it work.

TerminalFi commented 6 months ago

@raffeyang I've not fully tested but I believe this is already supported

Just add to your settings

{
    "command": [
        "${node_bin}",
        "${server_path}",
        "--stdio"
    ],
    "schemes": [
        "file",
        "buffer",
        "res"
    ],
    "settings": {
        "auto_ask_completions": true,
        "debug": false,
        "hook_to_auto_complete_command": false,
        "local_checks": false,
        "telemetry": false,
        "proxy": "",
        "completion_style": "popup",
        "github-enterprise": {
            "uri": "URI HERE"
        }
    },
    // ST4 configuration
    "selector": "source | text | embedding"
}