diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ba49e3c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,5 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 diff --git a/.github/workflows/update.yaml b/.github/workflows/update.yaml deleted file mode 100644 index b49aaaa..0000000 --- a/.github/workflows/update.yaml +++ /dev/null @@ -1,71 +0,0 @@ -name: Update Version - -permissions: - contents: write - -on: - workflow_dispatch: - schedule: - - cron: "0 2 * * *" # Every day at 2AM - -jobs: - update-versions: - name: Update versions.json - runs-on: ubuntu-latest - steps: - - uses: nixbuild/nix-quick-install-action@v22 - - name: Get Latest Release - uses: octokit/request-action@v2.x - id: get_latest_release - with: - route: GET /repos/{owner}/{repo}/releases/latest - owner: Exafunction - repo: codeium - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/checkout@v3 - - name: Update files - id: update - run: | - VERSION=${{ fromJSON(steps.get_latest_release.outputs.data).tag_name }} - VERSION=${VERSION#language-server-v} - - curl -L "https://github.com/Exafunction/codeium/releases/download/language-server-v$VERSION/language_server_linux_x64" \ - -o ./language_server - chmod +x ./language_server - STAMP=$(./language_server --stamp | sed -nr 's/STABLE_BUILD_SCM_REVISION: ([0-9a-fA-F]*)/\1/p') - - LINUX_X64=$(nix-prefetch-url --type sha256 "https://github.com/Exafunction/codeium/releases/download/language-server-v$VERSION/language_server_linux_x64") - LINUX_ARM=$(nix-prefetch-url --type sha256 "https://github.com/Exafunction/codeium/releases/download/language-server-v$VERSION/language_server_linux_arm") - MACOS_X64=$(nix-prefetch-url --type sha256 "https://github.com/Exafunction/codeium/releases/download/language-server-v$VERSION/language_server_macos_x64") - MACOS_ARM=$(nix-prefetch-url --type sha256 "https://github.com/Exafunction/codeium/releases/download/language-server-v$VERSION/language_server_macos_arm") - - jq \ - --arg "VERSION" "$VERSION" --arg "STAMP" "$STAMP" \ - --arg "LINUX_X64" "$LINUX_X64" --arg "LINUX_ARM" "$LINUX_ARM" \ - --arg "MACOS_X64" "$MACOS_X64" --arg "MACOS_ARM" "$MACOS_ARM" \ - '{ - "version": $VERSION, - "stamp": $STAMP, - "hashes": { - "x86_64-linux": $LINUX_X64, - "aarch64-linux": $LINUX_ARM, - "x86_64-darwin": $MACOS_X64, - "aarch64-darwin": $MACOS_ARM - } - }' <<< "{}" | tee lua/codeium/versions.json | jq -C - - if git diff --exit-code lua/codeium/versions.json > /dev/null; then - echo "changed=false" >> "$GITHUB_OUTPUT" - else - echo "changed=true" >> "$GITHUB_OUTPUT" - fi - echo "version=$VERSION" >> "$GITHUB_OUTPUT" - - name: Commit and push - if: steps.update.outputs.changed == 'true' - run: | - git add lua/codeium/versions.json - git config --global user.name "codeium.nvim [bot]" - git config --global user.email "codeium-nvim-bot@example.com" - git commit -m "Update Codeium LSP to ${{ steps.update.outputs.version }}" - git push diff --git a/lua/codeium/io.lua b/lua/codeium/io.lua index ae52622..ae44b67 100644 --- a/lua/codeium/io.lua +++ b/lua/codeium/io.lua @@ -456,13 +456,12 @@ end function M.shell_open(...) local info = M.get_system_info() if info.os == "linux" then - return M.get_command_output("xdg-open",...) + return M.get_command_output("xdg-open", ...) elseif info.os == "macos" then return M.get_command_output("/usr/bin/open", ...) else - return M.get_command_output("cmd", "/C start ".. string.gsub(..., "&","^&") ) + return M.get_command_output("cmd", "/C start " .. string.gsub(..., "&", "^&")) end end - return M diff --git a/lua/codeium/source.lua b/lua/codeium/source.lua index 47bbc8e..c97d757 100644 --- a/lua/codeium/source.lua +++ b/lua/codeium/source.lua @@ -15,8 +15,8 @@ local function codeium_to_cmp(comp, offset, right) local documentation = comp.completion.text local label = string.sub(documentation, offset) - if string.sub(label, -#right) == right then - label = string.sub(label, 1, -#right - 1) + if string.sub(label, - #right) == right then + label = string.sub(label, 1, - #right - 1) end -- We get the completion part that has the largest offset diff --git a/lua/codeium/update.lua b/lua/codeium/update.lua index 5f68c6f..3870a39 100644 --- a/lua/codeium/update.lua +++ b/lua/codeium/update.lua @@ -65,10 +65,10 @@ function M.validate(callback) else notify.error( stamp - .. " does not match the expected Codeium server stamp of " - .. versions.extension_stamp - .. ". Please update to: https://github.com/Exafunction/codeium/releases/tag/language-server-v" - .. versions.extension + .. " does not match the expected Codeium server stamp of " + .. versions.extension_stamp + .. ". Please update to: https://github.com/Exafunction/codeium/releases/tag/language-server-v" + .. versions.extension ) callback(nil) return @@ -78,7 +78,7 @@ function M.validate(callback) notify.warn( "Codeium.nvim: the version of the Codeium server could not be determined, make sure it matches " - .. versions.extension + .. versions.extension ) callback(nil) end, diff --git a/lua/codeium/util.lua b/lua/codeium/util.lua index b0ffce6..cde6500 100644 --- a/lua/codeium/util.lua +++ b/lua/codeium/util.lua @@ -20,15 +20,15 @@ function M.get_editor_options(bufnr) return { tab_size = M.fallback_call({ - { vim.api.nvim_buf_get_option, bufnr, "shiftwidth" }, - { vim.api.nvim_buf_get_option, bufnr, "tabstop" }, - { vim.api.nvim_get_option, "shiftwidth" }, - { vim.api.nvim_get_option, "tabstop" }, + { vim.api.nvim_buf_get_option, bufnr, "shiftwidth" }, + { vim.api.nvim_buf_get_option, bufnr, "tabstop" }, + { vim.api.nvim_get_option, "shiftwidth" }, + { vim.api.nvim_get_option, "tabstop" }, 4, }, greater_than_zero), insert_spaces = M.fallback_call({ - { vim.api.nvim_buf_get_option, bufnr, "expandtab" }, - { vim.api.nvim_get_option, "expandtab" }, + { vim.api.nvim_buf_get_option, bufnr, "expandtab" }, + { vim.api.nvim_get_option, "expandtab" }, true, }), } diff --git a/lua/codeium/versions.json b/lua/codeium/versions.json index e1a4416..d8b18be 100644 --- a/lua/codeium/versions.json +++ b/lua/codeium/versions.json @@ -1,10 +1,11 @@ { - "version": "1.2.85", - "stamp": "3c46f91ffae2eeb50cb1ca62b60b74de224a06a7", + "version": "1.2.90", + "stamp": "7b00044fee859ddf8cf5e6501e648af5c6587c22", "hashes": { - "x86_64-linux": "sha256-RNIF+Ie/xOO06SQEZcnMi8+6uTZEtWsmdO52PL5N0F0=", - "aarch64-linux": "07cpm2hb16w9a8xpd34c25xgwmsc1vrr6y2mxvx2p0dkg98gkjcn", - "x86_64-darwin": "0xdcmiwkqi911bw8zm8znlzdwy6w8wb4m2ry05d2zj7p23f0wn7b", - "aarch64-darwin": "152z3qabx0dkrqn6h5ds5fns0qpg5xksbq2yadjqjl1s0z0hdh0q" + "x86_64-linux": "sha256-dGWdn2q6HoAtUEqTqXCr0VXMSfTVwA0SIeMLUw9eR4w=", + "aarch64-linux": "sha256-x2ijEosNN3Vl/qY8vs5bnI6o8dr4ZbuqWbu2p8wy9Do=", + "x86_64-darwin": "sha256-0jctwQxd1WOqc2SZnYBoa5reV7XU5Nv347Z3jkWoGMw=", + "aarch64-darwin": "sha256-w4p4pfmcfpYPr9Axb9joYLnTkOksDhfZI2NkO6BWniI=", + "x86_64-windows": "sha256-Auj09zGsm/d5cuhsYhuurCJ8tq6thdDfHpnw6WZuqVA=" } } diff --git a/lua/codeium/views/auth-menu.lua b/lua/codeium/views/auth-menu.lua index 866645a..350a293 100644 --- a/lua/codeium/views/auth-menu.lua +++ b/lua/codeium/views/auth-menu.lua @@ -2,10 +2,10 @@ local io = require("codeium.io") local notify = require("codeium.notify") local function get_key(callback) - local result = vim.fn.inputsecret("Token ") - if result then - callback(result) - end + local result = vim.fn.inputsecret("Token ") + if result then + callback(result) + end end local function open_buffer(url, callback)