Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cleanup for non-windows using HttpIt + updates to docker setup
  • Loading branch information
DanBradbury committed Mar 10, 2025
commit 7d95b58e679a44af8fc75c37972282f4db025ba5
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:latest
RUN apk update && apk add git vim curl wslview
RUN apk update && apk add git vim curl
RUN mkdir -p ~/.vim/bundle
RUN git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
9 changes: 8 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"dockerFile": "Dockerfile",
"postStartCommand": "cp .devcontainer/vimrc ~/.vimrc && vim +PluginInstall +qall && cp -r * ~/.vim/bundle/copilot.vim/"
"postStartCommand": "cp .devcontainer/vimrc ~/.vimrc && vim +PluginInstall +qall && cp -r * ~/.vim/bundle/copilot.vim/",
"customizations": {
"vscode": {
"extensions": [
"XadillaX.viml"
]
}
}
}
15 changes: 2 additions & 13 deletions plugin/copilot_chat.vim
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,15 @@ function HttpIt(method, url, headers, body)
let l:ps_cmd .= '"'
let l:response = system(l:ps_cmd)
else
let l:token_headers = [
\ 'Accept: application/json',
\ 'User-Agent: GithubCopilot/1.155.0',
\ 'Accept-Encoding: gzip,deflate,br',
\ 'Editor-Plugin-Version: copilot.vim/1.16.0',
\ 'Editor-Version: Neovim/0.6.1',
\ 'Content-Type: application/json',
\ ]
let l:token_data = json_encode(a:body)

" Construct the curl command for token setup
let l:curl_cmd = 'curl -s -X POST --compressed '
let l:curl_cmd = 'curl -s -X ' . a:method . ' --compressed '
for header in a:headers
let l:curl_cmd .= '-H "' . header . '" '
endfor
let l:curl_cmd .= "-d '" . l:token_data . "' " . l:token_url
let l:curl_cmd .= "-d '" . l:token_data . "' " . a:url

let l:response = system(l:curl_cmd)

" Check for errors in the response
if v:shell_error != 0
echom 'Error: ' . v:shell_error
return ''
Expand Down