Compare commits

...

1018 Commits

Author SHA1 Message Date
Mathew Pareles 93d40be1ac Merge remote-tracking branch 'origin/main' into model-selection 2025-03-01 17:43:18 -08:00
Mathew Pareles cfc39b83bb styles 2025-03-01 17:42:17 -08:00
Mathew Pareles 9c76a35837 outline 2025-03-01 17:42:17 -08:00
Mathew Pareles 4a00bd3e00 Cmd+L selections open better ux 2025-03-01 17:42:17 -08:00
Mathew Pareles 6d6e2fa974 fix annoying refactor 2025-03-01 17:42:17 -08:00
Mathew Pareles 971ce88df2 style 2025-03-01 17:40:29 -08:00
Andrew Pareles 7e34037ffe Merge pull request #288 from eswaldots/main
Fix encryption service not working on Linux
2025-02-28 14:11:52 -08:00
Andrew Pareles aa835d468b misc 2025-02-27 20:13:50 -08:00
Mathew Pareles 661eba3ae9 fix selection state bug 2025-02-27 17:08:49 -08:00
Mathew Pareles de17b3add1 styles 2025-02-27 16:27:34 -08:00
Mathew Pareles 6fa3901ab0 small style 2025-02-27 16:22:13 -08:00
Andrew Pareles d14a2f1fff marketplace URL 2025-02-26 02:22:58 -08:00
Andrew Pareles c1f3b92c51 fix manual reasoning parsing 2025-02-26 02:14:00 -08:00
Andrew Pareles 0de63a088d reasoning UI! 2025-02-26 02:01:04 -08:00
Andrew Pareles 0de1c20551 progress 2025-02-26 02:01:03 -08:00
Mathew Pareles a769eb4db0 Merge branch 'recovered-branch' into model-selection 2025-02-25 19:09:28 -08:00
Mathew Pareles 3e7e54b88f Merge branch 'model-selection' into HEAD 2025-02-25 18:48:38 -08:00
Mathew Pareles 1b43799371 prepare merg 2025-02-25 18:48:17 -08:00
Andrew Pareles 8438f80834 updates 2025-02-25 15:23:34 -08:00
Andrew Pareles 63b15af385 add claude 3.7 init 2025-02-25 15:23:34 -08:00
Andrew Pareles 57c9184f4e Update CONTRIBUTING.md 2025-02-24 18:53:42 -08:00
Andrew Pareles 0b6dd721e9 Update CONTRIBUTING.md 2025-02-24 18:53:18 -08:00
Andrew Pareles 88ac766f53 Update CONTRIBUTING.md 2025-02-24 18:51:56 -08:00
Andrew Pareles 58466afe72 Merge pull request #287 from jhacksman/devin/1739626558-fix-think-tag-apply
Fix Apply failure with <think> tags (#283)
2025-02-24 14:58:10 -08:00
Andrew Pareles 04efe1d235 added extractReasoningFromText in extractCodeFromResult instead 2025-02-24 14:57:50 -08:00
Andrew Pareles aa9a102b71 Merge remote-tracking branch 'origin/main' into pr/jhacksman/287 2025-02-24 14:55:01 -08:00
Andrew Pareles dc0f9bdada Merge pull request #282 from bjoaquinc/remote-ssh-extension
Added remote-ssh extension to /extensions
2025-02-24 14:52:40 -08:00
Andrew Pareles 75f30bf7cd Merge pull request #294 from voideditor/model-selection
Provider Settings + UX improvements
2025-02-24 06:24:08 -08:00
Andrew Pareles 4a43b628d4 improvements 2025-02-24 06:23:24 -08:00
Mathew Pareles 38370c751e + 2025-02-24 05:59:56 -08:00
Mathew Pareles 764b1a2ccf improve input box 2025-02-24 05:47:58 -08:00
Andrew Pareles 5c047b78f3 style+FIM prompt 2025-02-24 05:33:45 -08:00
Andrew Pareles 5cbd0a19a4 minor fixes 2025-02-24 04:38:08 -08:00
Andrew Pareles d2fb0fb4ff maxTokens for anthropic 2025-02-24 04:32:53 -08:00
Mathew Pareles 1dffbfb061 style 2025-02-24 04:09:09 -08:00
Andrew Pareles 3ae8f75641 remove mistral, finish(?) models! 2025-02-24 04:01:00 -08:00
Mathew Pareles df6de2d7fc styles for tool use 2025-02-24 03:51:59 -08:00
Mathew Pareles 4ebfa91a83 fix URI staleness bug in local storage 2025-02-24 00:46:03 -08:00
Andrew Pareles 9f20476eea provider support progress
Co-authored-by: Mathew Pareles <mathewpareles@users.noreply.github.com>
2025-02-23 21:37:34 -08:00
Andrew Pareles fd5e523434 models 2025-02-23 16:58:43 -08:00
Andrew Pareles 2c2714273e partway through adding better support for more providers 2025-02-23 01:28:51 -08:00
Mathew Pareles c650091418 style 2025-02-22 21:11:58 -08:00
Mathew Pareles d96a9d5f6b fix typeerror 2025-02-22 21:11:58 -08:00
Mathew Pareles a9b3cc146b refactor 2025-02-22 21:11:58 -08:00
Mathew Pareles bdb897d032 tool UI draft 2025-02-22 21:11:58 -08:00
Andrew Pareles 2a876d8efe + 2025-02-22 21:08:34 -08:00
Andrew Pareles bf4392a52f safe 2025-02-22 17:53:14 -08:00
Andrew Pareles dd24c3180d + 2025-02-22 17:52:58 -08:00
Andrew Pareles f40acd76f1 endpoint 2025-02-22 17:52:28 -08:00
Andrew Pareles 96de4f028f remove unnecessary check 2025-02-22 04:35:56 -08:00
Andrew Pareles 2ecce822f3 fix react - tedious 2025-02-22 04:30:17 -08:00
Andrew Pareles ea10765abd remove applybox stuff from editCode 2025-02-22 03:41:16 -08:00
Andrew Pareles 16f6181395 + 2025-02-22 03:23:44 -08:00
Andrew Pareles 19ebf4a1a2 seems to work! some annoying react state stuff.. 2025-02-22 03:03:05 -08:00
Andrew Pareles 63b71dec24 should work, just need to debug 2025-02-22 00:40:46 -08:00
Andrew Pareles 1079893527 add codeBoxId, but now will change to uri 2025-02-21 23:31:06 -08:00
Andrew Pareles 64ac6d4a12 ctrlK 2025-02-21 21:09:03 -08:00
Andrew Pareles 9005de65a6 quick edit stream state? 2025-02-21 20:53:09 -08:00
Andrew Pareles 86dfc5521d more progress (still broken) + fix weird _useThread() + rm initStreamingDiffZoneId 2025-02-21 20:10:02 -08:00
Andrew Pareles b005b1e95a progress (BROKEN) 2025-02-21 18:53:55 -08:00
Andrew Pareles ce14986d2f split apply buttons 2025-02-21 16:19:01 -08:00
Andrew Pareles 06ce9e1017 settings styles + password field 2025-02-21 15:06:42 -08:00
Andrew Pareles 09f5d3e14b nitpick style 2025-02-21 00:19:58 -08:00
Andrew Pareles 73c3a8133a massively simplified, seems to work! 2025-02-20 23:59:16 -08:00
Andrew Pareles 8918a14404 almost there 2025-02-20 23:23:58 -08:00
Andrew Pareles 1959c53d75 progress 2025-02-20 23:23:55 -08:00
Andrew Pareles 33d80bed80 progress 2025-02-20 17:25:53 -08:00
Andrew Pareles 970f0bdb9d revert "Void's" on the button 2025-02-20 01:28:46 -08:00
Andrew Pareles 7711c74ef0 reorder 2025-02-20 01:21:56 -08:00
Andrew Pareles e14aab632d multiple find/replace blocks almost work. only 1 diffarea per find/replace application 2025-02-20 01:21:28 -08:00
Andrew Pareles 62c2622ced Void's settings 2025-02-19 17:57:40 -08:00
Andrew Pareles 0f26ee2288 misc fixes 2025-02-19 00:47:03 -08:00
Andrew Pareles 6a44d668db + 2025-02-19 00:16:25 -08:00
Mathew Pareles 858b6f6a91 file service read 2025-02-19 00:12:51 -08:00
Andrew Pareles 7206209743 Merge pull request #290 from voideditor/model-selection
Tool use progress
2025-02-19 00:03:01 -08:00
Andrew Pareles 02f64b7ff6 finish tool pagination 2025-02-18 22:28:04 -08:00
Andrew Pareles ac1788ae9a tool pages work, improve prompt 2025-02-18 21:25:23 -08:00
Andrew Pareles 5699cf19f4 merge updates 2025-02-18 16:12:16 -08:00
Andrew Pareles 9ab9196b38 Merge remote-tracking branch 'origin/edit-chats' into model-selection 2025-02-18 16:12:11 -08:00
Mathew Pareles baa89cc17d dummy marker service 2025-02-18 14:14:38 -08:00
Andrew Pareles 667769c987 tool update; multiple SEARCH/REPLACE blocks 2025-02-17 23:57:59 -08:00
Mathew Pareles d3aa0bc3cc fix readfile 2025-02-17 17:56:20 -08:00
Andrew Pareles d3547134e7 get ready to add searchReplaceService 2025-02-17 15:22:24 -08:00
Mathew Pareles b92420012c minor 2025-02-17 15:18:11 -08:00
Andrew Pareles 0fd10f404e tool results in ChatMessage 2025-02-17 14:12:52 -08:00
Andrew Pareles 137e0068a3 add vllm 2025-02-17 01:50:28 -08:00
Andrew Pareles 366dbf0b52 add xAI and update system/tool information and system prompt 2025-02-17 01:06:21 -08:00
Mathew Pareles 89d08071fc scrollbar fix 2025-02-17 00:23:48 -08:00
Andrew Pareles 8a8ed1ac56 + 2025-02-17 00:20:01 -08:00
Andrew Pareles 491312218f + 2025-02-17 00:19:39 -08:00
Andrew Pareles b74b031906 + 2025-02-17 00:18:55 -08:00
Andrew Pareles 5608aca168 process 2025-02-17 00:17:14 -08:00
Andrew Pareles fecfbd924a error 2025-02-17 00:07:33 -08:00
Andrew Pareles a78a6169f8 tools + misc fixes 2025-02-17 00:07:11 -08:00
Andrew Pareles 628adedaec toolcalls 2025-02-16 20:51:42 -08:00
Andrew Pareles 432a1766af anthropic tool use fix 2025-02-16 20:50:07 -08:00
Mathew Pareles 74f8303803 discard star changes 2025-02-16 20:11:13 -08:00
Andrew Pareles 2bc3d67e39 minor tool use fix 2025-02-16 19:51:58 -08:00
Mathew Pareles 41fe5c50e2 fix scrollbars 2025-02-16 19:46:41 -08:00
Mathew Pareles 36b1b56690 bug 2025-02-16 19:46:41 -08:00
Mathew Pareles 249eee341d better context and file reading 2025-02-16 19:46:40 -08:00
Joaquin Coromina 2c61310077 Merge branch 'voideditor:main' into remote-ssh-extension 2025-02-16 23:32:00 +07:00
Joaquin Coromina a519100852 Added open-remote-ssh to npm install dirs and the output files in eslint ignore 2025-02-16 23:31:21 +07:00
eswaldots a38fc81a58 Fix encryption service dont working on Linux 2025-02-16 15:34:53 +00:00
Andrew Pareles af41d6a439 tool improvements 2025-02-16 03:23:37 -08:00
Andrew Pareles 7244d433dd tools should work! 2025-02-16 02:53:56 -08:00
Andrew Pareles 131493b5e1 tool structure 2025-02-16 00:43:46 -08:00
Devin AI 4c5e444bcb Improve token streaming support with character-by-character matching
Co-Authored-By: Jack Hacksman <slack@hannis.io>
2025-02-16 05:14:40 +00:00
Devin AI 2f55580e67 Improve token streaming support with character-by-character matching
Co-Authored-By: Jack Hacksman <slack@hannis.io>
2025-02-16 05:06:37 +00:00
Devin AI b24cd1ecb7 Improve token streaming support for think tags
Co-Authored-By: Jack Hacksman <slack@hannis.io>
2025-02-16 05:01:57 +00:00
Devin AI a519bd7690 Add streaming support for think tags and test cases
Co-Authored-By: Jack Hacksman <slack@hannis.io>
2025-02-16 04:59:55 +00:00
Andrew Pareles 8591d06244 tool use plugboard progress 2025-02-15 19:23:15 -08:00
Andrew Pareles a26816d597 Update src/vs/workbench/contrib/chat/common/chatModel.ts
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
2025-02-15 15:46:39 -08:00
Andrew Pareles ea6e025511 Merge pull request #284 from adrieljss/main
fix ENOENT error spawn on Windows
2025-02-15 15:37:39 -08:00
Devin AI 7849b0a107 Fix Apply failure with <think> tags (#283)
- Add utility to strip <think> tags from responses
- Strip tags before computing diffs in Apply operation
- Handle nested tags properly
- Keep original response intact for UI display

Fixes #283

Co-Authored-By: Jack Hacksman <slack@hannis.io>
2025-02-15 13:35:58 +00:00
Andrew Pareles 152e605856 tool progress! 2025-02-15 02:05:37 -08:00
Andrew Pareles bc6150aeac tools 2025-02-15 00:02:17 -08:00
Andrew Pareles 05d8b3a982 handle updates with version number instead of weird check 2025-02-15 00:01:37 -08:00
Andrew Pareles d91ec9da2e inlineDiffsService -> editCodeService 2025-02-14 21:43:38 -08:00
Mathew Pareles 198a948f6c star button commit 2025-02-14 21:30:20 -08:00
adrieljss 1839acab1f fix ENOENT error spawn on Windows 2025-02-14 17:59:56 +08:00
Andrew Pareles 6ad48ffa20 recognizedModels 2025-02-14 01:59:17 -08:00
Andrew Pareles 0975f1bf5f add developer info for models 2025-02-14 01:52:17 -08:00
Andrew Pareles 9cfcf396c1 update types for tool support 2025-02-14 01:05:10 -08:00
Andrew Pareles 0bcd88dad6 fix 2025-02-13 23:54:22 -08:00
Andrew Pareles 343ee5eb94 Apply name 2025-02-13 23:00:01 -08:00
Mathew Pareles d9e4679b65 breaking changes - ai regex 2025-02-13 22:58:42 -08:00
Joaquin Coromina 4950de2cb5 Merge branch 'voideditor:main' into remote-ssh-extension 2025-02-14 10:06:42 +07:00
Joaquin Coromina 28bf838b55 Updated void-server endpoiont to make it dynamic 2025-02-14 10:05:30 +07:00
Andrew Pareles b01684393a streaming works! 2025-02-13 00:37:43 -08:00
Andrew Pareles 34b8027fb9 streaming progress 2025-02-13 00:08:23 -08:00
Andrew Pareles f7af9c336b tokenIdx 2025-02-12 21:58:57 -08:00
Andrew Pareles a479a32ad5 small fix 2025-02-12 21:55:58 -08:00
Andrew Pareles 7cdb003c47 stream state 2025-02-12 21:51:58 -08:00
Andrew Pareles 4f9f16b93f almost works (but doesn't delete old text) 2025-02-12 21:27:39 -08:00
Mathew Pareles 7dcb08b09a comment out unwanted code 2025-02-12 20:50:04 -08:00
Andrew Pareles 7fbe8d905f Merge pull request #281 from voideditor/model-selection
Latest streaming changes
2025-02-12 18:51:55 -08:00
Joaquin Coromina 79fb8f63a7 Added Open Remote-SSH extension to Void 2025-02-13 01:33:43 +07:00
Andrew Pareles 0dfa81f637 Search and replace? 2025-02-12 01:43:50 -08:00
Andrew Pareles d504daffa5 searchRepalce 2025-02-12 00:34:24 -08:00
Andrew Pareles fc97949887 autocomplete 2025-02-11 22:02:46 -08:00
Andrew Pareles 0346e90ca7 add parsing of <<< ORIGINAL, ===, FINAL >>> 2025-02-11 21:38:56 -08:00
Mathew Pareles efeb85b48b Merge remote-tracking branch 'origin/model-selection' into edit-chats 2025-02-11 18:44:20 -08:00
Mathew Pareles d698e6f3c1 prepare fast apply 2025-02-11 18:42:40 -08:00
Andrew Pareles 2161d740df minor change 2025-02-11 16:44:40 -08:00
Andrew Pareles a3e6deb1a8 Merge pull request #278 from bjoaquinc/build-void-server
fix(build): fixes void-reh (remote host) build crashes and updates the remote-host output path to say void rather than vscode
2025-02-11 16:43:41 -08:00
Andrew Pareles 96b5b72d30 triple tick 2025-02-10 20:22:31 -08:00
Andrew Pareles e2e8279fce add back imports 2025-02-10 20:18:45 -08:00
Andrew Pareles 5ed1f465a2 MOVE VOID FILES TO WORKBENCH 2025-02-10 18:59:26 -08:00
Andrew Pareles 995357710e misc 2025-02-10 18:33:51 -08:00
Andrew Pareles a98106072c Merge remote-tracking branch 'origin/edit-chats' into model-selection 2025-02-10 15:35:37 -08:00
Andrew Pareles c1be466467 tool tests 2025-02-10 15:34:07 -08:00
Joaquin Coromina 6f6f43c46e Fixed compilation for void-reh bug by updating package.json in remote and changed destination folder to say void 2025-02-10 19:54:50 +07:00
Andrew Pareles 9cbe83b57c comment 2025-02-09 00:46:39 -08:00
Andrew Pareles e46b295449 names 2025-02-09 00:45:06 -08:00
Andrew Pareles 3fd3634257 void message 2025-02-09 00:36:03 -08:00
Andrew Pareles 231990088a uri 2025-02-09 00:28:44 -08:00
Andrew Pareles 20da82762e rm comment 2025-02-09 00:27:36 -08:00
Andrew Pareles 0d9be68aff rm comment 2025-02-09 00:27:21 -08:00
Andrew Pareles 165b5a4fd2 + 2025-02-09 00:26:58 -08:00
Andrew Pareles 812014d6d3 all tools seem to work! 2025-02-09 00:26:42 -08:00
Andrew Pareles d3e73b92e0 + 2025-02-08 22:56:55 -08:00
Andrew Pareles 00da05f24f context tools 2025-02-08 22:53:13 -08:00
Mathew Pareles e4694256eb Merge remote-tracking branch 'origin/model-selection' into edit-chats 2025-02-08 21:47:27 -08:00
Andrew Pareles 18b278577d tools 2025-02-08 21:17:38 -08:00
Mathew Pareles a252bb7a30 prepare merge 2025-02-08 17:26:28 -08:00
Mathew Pareles c240360710 edit update locally (need to test) 2025-02-08 17:14:16 -08:00
Mathew Pareles 893308c38e edits work 2025-02-07 02:06:04 -08:00
Mathew Pareles 48defe849d edit backend 2025-02-06 22:34:39 -08:00
Andrew Pareles 3c03f58488 clarify API 2025-02-06 22:16:42 -08:00
Mathew Pareles 2470e0de7f refactor 2025-02-06 19:01:15 -08:00
Mathew Pareles 387fd64db0 edit ability 2025-02-06 03:18:48 -08:00
Andrew Pareles 4ffd269db5 + 2025-02-06 03:11:26 -08:00
Andrew Pareles 5ce25e20c3 css for <html> md tags 2025-02-06 03:10:07 -08:00
Andrew Pareles 63efa219f5 div 2025-02-06 03:04:48 -08:00
Andrew Pareles 826d148305 html 2025-02-06 03:03:14 -08:00
Andrew Pareles 323d80ef55 add divs for html 2025-02-06 03:02:46 -08:00
Andrew Pareles 5fa21be9d2 Merge pull request #273 from voideditor/model-selection
UI improvements
2025-02-06 02:05:18 -08:00
Andrew Pareles 902588638d Merge remote-tracking branch 'origin/main' into model-selection 2025-02-06 02:04:48 -08:00
Andrew Pareles a1ab094652 + 2025-02-06 02:01:24 -08:00
Andrew Pareles 902b460b9c + 2025-02-06 02:00:33 -08:00
Andrew Pareles 073205ace3 warningbox and misc 2025-02-06 01:59:26 -08:00
Andrew Pareles 98c1d81875 focus() fix 2025-02-06 01:55:36 -08:00
Andrew Pareles 2f49650e15 model and provider error handling 2025-02-06 01:32:48 -08:00
Mathew Pareles 1be9300dc4 typeo 2025-02-05 18:19:04 -08:00
Andrew Pareles d9b77b67b2 prefix 2025-02-05 01:50:29 -08:00
Andrew Pareles 2f674f5323 update openai models 2025-02-05 01:10:40 -08:00
Andrew Pareles c8fa39e552 openai fim progress 2025-02-05 00:57:03 -08:00
Andrew Pareles 3b73e3ab26 metrics for sendFIM 2025-02-05 00:40:09 -08:00
Andrew Pareles c606ac4361 chat name 2025-02-05 00:38:49 -08:00
Andrew Pareles da4c9c8c40 fim better abstraction 2025-02-05 00:37:28 -08:00
Mathew Pareles 31ed11393f fix non-ollama autocomplete 2025-02-04 21:24:49 -08:00
Andrew Pareles 1c5157d97e remove hi333 2025-02-04 20:56:58 -08:00
Andrew Pareles cf241867d8 add recognizedModels code 2025-02-04 20:34:02 -08:00
Andrew Pareles 5a9f9f70d9 separate fastapply model 2025-02-04 20:34:02 -08:00
Andrew Pareles 19ff19fb80 Merge branch 'copy-icons' of https://github.com/voideditor/void into model-selection 2025-02-04 20:34:02 -08:00
Mathew Pareles 87076ed586 remove comments 2025-02-04 20:07:57 -08:00
Mathew Pareles 473250d8bc autocomplete works without context 2025-02-04 20:02:14 -08:00
Mathew Pareles cd983f0dd9 refactor input box with no noticable errors 2025-02-04 01:20:33 -08:00
Mathew Pareles 5c4753555e chatbubble add edit button (need to refactor InputBox to finish) 2025-02-03 21:06:29 -08:00
Mathew Pareles 8f79222b8b fix spacing 2025-02-03 18:45:25 -08:00
Mathew Pareles 145fd9614b changes 2025-02-03 18:27:57 -08:00
Mathew Pareles 41057c20fc autocomplete type context 2025-02-03 18:17:05 -08:00
Mathew Pareles 528b8a6b9b better model onboard 2025-02-03 18:17:05 -08:00
Andrew Pareles e3941d5565 + 2025-02-01 18:41:56 -08:00
Andrew Pareles 4d11a4fd29 Merge pull request #252 from bawsdeep/main
script to generate appimages
2025-01-31 20:52:44 -08:00
Andrew Pareles 3baaf8d6c4 comment 2025-01-31 20:24:09 -08:00
Andrew Pareles 0ec0c324b1 void settings opening behavior 2025-01-31 20:17:51 -08:00
Andrew Pareles aa580351d9 Merge pull request #259 from DoctorGlitchy/main
Update voidSettingsTypes.ts
2025-01-31 01:22:16 -08:00
Adrian Chan 570e13127d Update voidSettingsTypes.ts
Removed "distil-whisper-large-v3-en" because Whisper is not a model you chat with.
Added "llama3-70b-8192" + "mixtral-8x7b-32768"
2025-01-31 13:11:33 +11:00
Andrew Pareles fb7b50b36b Merge pull request #258 from voideditor/model-selection
Latest UI updates
2025-01-30 16:39:13 -08:00
Andrew Pareles 9cd8295dab fix comment 2025-01-30 16:38:51 -08:00
Andrew Pareles 9ec13d2ad8 rm comments 2025-01-30 16:37:44 -08:00
Andrew Pareles d9cf21448c add model selection + misc UI improvements (notably, change how model dropdown works) 2025-01-30 15:07:02 -08:00
Andrew Pareles 27d009314b finish merge 2025-01-29 15:55:18 -08:00
Andrew Pareles 5fdd21f12b Merge remote-tracking branch 'origin/main' into model-selection 2025-01-29 15:54:07 -08:00
Andrew Pareles dc5c7e9a46 Merge remote-tracking branch 'origin/main' into model-selection 2025-01-28 21:02:17 -08:00
Baws Deep d1c5cf518e Add files via upload 2025-01-29 05:41:12 +01:00
Andrew Pareles c1123f2cfd Merge pull request #233 from bjoaquinc/react-build-bug-fix
Fix npm run watchreact initial build bug
2025-01-28 20:04:51 -08:00
Andrew Pareles fb0bb0ca31 Merge remote-tracking branch 'origin/main' into pr/bjoaquinc/233 2025-01-28 20:04:11 -08:00
Andrew Pareles 4863802713 contrib 2025-01-28 20:02:57 -08:00
Andrew Pareles 5589b2e302 updates 2025-01-28 20:02:15 -08:00
Andrew Pareles 327dbb937b Merge pull request #183 from bjoaquinc/react-build-improvements
Improve React build by incorporating the watcher in base build commands
2025-01-28 19:56:05 -08:00
Mathew Pareles a3e62ee6f4 autocompletion multiline works 2025-01-28 01:43:47 -08:00
Andrew Pareles d7a6611d89 read 2025-01-28 01:23:40 -08:00
Mathew Pareles e4bb15ef64 autocomplete draft 2025-01-27 22:20:19 -08:00
Andrew Pareles a98c77572e add gap-4 and remove mt-4 for chat bubbles 2025-01-27 22:18:12 -08:00
Mathew Pareles e4d747d0a6 andrew ollamaFIM progress 2025-01-26 23:49:16 -08:00
Mathew Pareles 01b1358a01 autocomplete refactor 2025-01-26 19:01:03 -08:00
Mathew Pareles c7a6bddfbe groq 2025-01-26 19:01:03 -08:00
Andrew Pareles 55ea8e61c6 Merge pull request #190 from jcommaret/feat-mistral-new
[LLM]Mistral implementation
2025-01-25 19:40:44 -08:00
Andrew Pareles 4f7fd66c2f explanation 2025-01-25 19:39:38 -08:00
Andrew Pareles 4547363dde mistral fix 2025-01-25 19:38:55 -08:00
Andrew Pareles a1dfeb0f00 .tool-versions 2025-01-25 19:36:49 -08:00
Andrew Pareles b036a8c59c Merge remote-tracking branch 'origin/main' into pr/jcommaret/190 2025-01-25 19:35:05 -08:00
Andrew Pareles 72cd23f0ac Merge branch 'main' into pr/jcommaret/190 2025-01-25 19:31:25 -08:00
Andrew Pareles 49c2bcb848 Merge pull request #216 from Piyu-Pika/Gemini-experimental-model
Add new experimental Gemini models to default settings
2025-01-25 19:30:09 -08:00
Andrew Pareles 97ea0f77f9 remove duplicate model name and add storage fix 2025-01-25 19:29:22 -08:00
Andrew Pareles 0cd6e0fb67 ... 2025-01-25 19:01:47 -08:00
Andrew Pareles 7c227e237f key 2025-01-25 19:01:29 -08:00
Andrew Pareles 3089bb31b5 mistral 2025-01-25 18:39:37 -08:00
Jérôme Commaret 018fd016c8 trying to fix error 2025-01-26 02:05:58 +01:00
Mathew Pareles f69f90b4c8 Reset Window: Zoom Level default to 0 (#239)
Co-authored-by: Chandler Thompson <3262190+chandlertee@users.noreplyrgithub.com>
2025-01-25 16:37:00 -08:00
Jérôme Commaret 000747eb88 Merge branch 'main' into feat-mistral-new 2025-01-25 23:58:50 +01:00
Piyush Bhardwaj 74022e0306 Merge branch 'main' into Gemini-experimental-model 2025-01-25 19:42:54 +05:30
Andrew Pareles 21708fd7e0 contrib 2025-01-25 03:14:31 -08:00
Andrew Pareles 5593ff5d79 add key 2025-01-25 03:11:47 -08:00
Andrew Pareles 197067af5a contrib 2025-01-24 15:19:13 -08:00
Andrew Pareles eec4f6c95e email 2025-01-24 15:18:04 -08:00
Andrew Pareles 3e045117d6 contrib 2025-01-24 15:11:57 -08:00
Andrew Pareles 67c557b7b9 contributing 2025-01-24 15:02:16 -08:00
Joaquin Coromina 5ffd569fd8 Fixed npm run watch bug for first time builders by checking if src2 folder already exists, and if not then create it first before setting up the watchers 2025-01-25 00:02:26 +07:00
Jérôme Commaret ff83bb5edc Merge branch 'main' into feat-mistral-new and fix conflict introduced by Deepseek 2025-01-24 14:22:06 +01:00
Andrew Pareles a3f145328b Merge pull request #231 from voideditor/model-selection
DeepSeek as a provider
2025-01-24 03:24:46 -08:00
Mathew Pareles 02894c12de deepseek 2025-01-24 03:18:42 -08:00
Mathew Pareles 52b6c81507 update style of quickedit 2025-01-24 03:18:42 -08:00
Andrew Pareles 5df5f37a6a contributing 2025-01-24 01:12:12 -08:00
Andrew Pareles f247b76a6e Update README.md 2025-01-24 01:06:07 -08:00
Andrew Pareles d1c659be9d + 2025-01-24 01:05:31 -08:00
Andrew Pareles a6b4955f8d + 2025-01-23 21:58:48 -08:00
Andrew Pareles 03b0b98eed + 2025-01-23 21:58:26 -08:00
Andrew Pareles 7f7d30e40b + 2025-01-23 21:55:32 -08:00
Andrew Pareles f68bc52023 update readme 2025-01-23 21:42:55 -08:00
Andrew Pareles 520c971e3e remove jitter on load 2025-01-23 21:41:03 -08:00
Andrew Pareles 657e752987 fix autoupdate 2025-01-23 21:14:10 -08:00
Andrew Pareles 458a5160b0 metrics for updates 2025-01-23 20:58:07 -08:00
Andrew Pareles a90bbffeb9 Merge pull request #229 from voideditor/model-selection
Minor usability updates
2025-01-23 20:37:38 -08:00
Andrew Pareles 99ff885ce2 Merge remote-tracking branch 'origin/main' into model-selection 2025-01-23 20:34:35 -08:00
Andrew Pareles a97047ed43 higher code icon res 2025-01-23 20:34:10 -08:00
Andrew Pareles 00f10c283e update tracking 2025-01-23 20:11:15 -08:00
Andrew Pareles 57628ec244 rename version to vscodeVersion 2025-01-23 20:08:20 -08:00
Andrew Pareles c54dcd0b0c fix delta issue when streaming 2025-01-23 19:47:01 -08:00
Andrew Pareles e957932f39 avoid duplicate model listeners 2025-01-23 15:51:37 -08:00
Piyush Bhardwaj fea9d380cc Merge branch 'main' into Gemini-experimental-model 2025-01-23 22:35:17 +05:30
bjoaquinc f2318cc8a2 Merge branch 'voideditor:main' into react-build-improvements 2025-01-23 22:06:50 +07:00
Mathew Pareles 8264cccd04 change default theme to dark+. also set default zoom to -1 (window.zoomLevel.default) 2025-01-23 03:30:26 -08:00
Andrew Pareles a1ca0f9291 format 2025-01-23 03:25:00 -08:00
Andrew Pareles 58f06d3ebb minor changes 2025-01-23 02:55:29 -08:00
Mathew Pareles e06eda1cc4 wording 2025-01-23 02:28:24 -08:00
Mathew Pareles f4d72e3ee8 remove prompt spaces 2025-01-23 02:26:03 -08:00
Mathew Pareles b3837a3099 changes to prompt 2025-01-23 02:25:01 -08:00
Andrew Pareles c6ae6d5152 await whenReady 2025-01-23 01:36:45 -08:00
Andrew Pareles 2d43dbded1 write version 2025-01-23 00:18:13 -08:00
Andrew Pareles a34d652a1d improve prompts (+ change chat history types) 2025-01-23 00:02:50 -08:00
Andrew Pareles a0569b1ead better FIM codeblock matching 2025-01-23 00:02:50 -08:00
Andrew Pareles b3ebe85c04 rm system message 2025-01-23 00:02:50 -08:00
Mathew Pareles 0919775e77 refactors for autocomplete 2025-01-22 22:19:54 -08:00
Andrew Pareles da6636a948 update deviceId code 2025-01-22 18:13:48 -08:00
Mathew Pareles 6327c584cc remove role=system for compatibility 2025-01-22 17:23:02 -08:00
Andrew Pareles f7cf44136b loading 2025-01-22 16:57:02 -08:00
Andrew Pareles c8635a1bdb memo previous chat messages as we stream (important) 2025-01-22 16:02:34 -08:00
Andrew Pareles d7501112f5 fix error handling 2025-01-22 15:47:33 -08:00
Jérôme Commaret d7ca99e23d Merge branch 'main' into feat-mistral-new 2025-01-23 00:17:23 +01:00
Andrew Pareles 387be4db76 fix gemini 2025-01-22 03:25:27 -08:00
Andrew Pareles 2aec37fc57 numbering 2025-01-22 03:09:18 -08:00
Andrew Pareles 7e5cc27349 tes 2025-01-22 03:08:50 -08:00
Andrew Pareles 151cdb13e6 add roadmap 2025-01-22 02:56:56 -08:00
Andrew Pareles d54ccff4a2 see 2025-01-22 02:30:06 -08:00
Andrew Pareles c2f358bd5e #announcements 2025-01-22 01:18:50 -08:00
Andrew Pareles 198f04d87a minor 2025-01-22 01:04:08 -08:00
Andrew Pareles 326e75eb45 minor 2025-01-22 00:57:57 -08:00
Andrew Pareles 7891a908ff links 2025-01-22 00:55:22 -08:00
Andrew Pareles 6970ec9fd2 contrib 2025-01-22 00:54:01 -08:00
Mathew Pareles fd4f3c3ab6 Merge remote-tracking branch 'origin/main' into model-selection 2025-01-22 00:45:17 -08:00
Andrew Pareles aa2394e207 Update README.md 2025-01-22 00:38:26 -08:00
Andrew Pareles 3aa6d3d28a rm changelog 2025-01-21 23:15:44 -08:00
Andrew Pareles 98c1a7e528 minor change 2025-01-21 23:15:32 -08:00
Andrew Pareles c94dda65f7 Update CONTRIBUTING.md 2025-01-21 19:13:59 -08:00
Mathew Pareles 24e276ba47 ux 2025-01-21 18:55:15 -08:00
Andrew Pareles 028061c879 Update CONTRIBUTING.md 2025-01-21 18:48:27 -08:00
Mathew Pareles 4e0dd8f8db fix spacing 2025-01-21 17:59:16 -08:00
Mathew Pareles c239682ad8 better ux 2025-01-21 14:18:44 -08:00
Piyu-Pika cd9bb6a07d Add new experimental Gemini models to default settings 2025-01-21 21:46:02 +05:30
Jérôme Commaret fd989b2c13 Merge branch 'main' into feat-mistral-new 2025-01-20 16:12:45 +01:00
Andrew 3bfb50e6ee update bmp 2025-01-20 04:26:14 -08:00
Andrew Pareles 362d481ec4 Merge pull request #215 from voideditor/model-selection
Beta!
2025-01-20 03:02:41 -08:00
Andrew Pareles 1b4943f39e devmode 2025-01-20 01:03:53 -08:00
Andrew Pareles 8c443ab780 metrics 2025-01-20 01:01:33 -08:00
Andrew Pareles 7519f05238 update state 2025-01-20 00:51:27 -08:00
Andrew Pareles c2fc2577e0 move 2025-01-20 00:31:14 -08:00
Andrew Pareles 6e1f8a08b3 void manual updates 2025-01-20 00:21:38 -08:00
Andrew Pareles d9be67d17d updates 2025-01-19 21:36:48 -08:00
Andrew Pareles 60d22674e2 updates 2025-01-19 19:24:44 -08:00
Andrew Pareles e8c0ee631c fix 2025-01-19 17:36:54 -08:00
Andrew Pareles 6ba9d10a4a update 2025-01-19 17:23:23 -08:00
Andrew Pareles 4eff8f8e76 building files 2025-01-19 17:23:00 -08:00
Andrew Pareles 66e349c72e fix updates part 1 2025-01-19 06:21:09 -08:00
Andrew 146d63c41e Merge remote-tracking branch 'origin/main' into model-selection 2025-01-19 03:04:15 -08:00
Andrew 82439406a0 icon updates 2025-01-19 03:03:45 -08:00
Andrew Pareles efeb0d28b7 tab switch fix 2025-01-19 02:59:22 -08:00
Andrew Pareles aba7d7bf90 Merge pull request #214 from voideditor/model-selection
Latest UX/UI updates
2025-01-17 21:13:16 -08:00
Andrew Pareles f517dc79a9 rm console 2025-01-17 19:10:13 -08:00
Andrew Pareles dc33d4d0c0 fix offset collision with deletion 2025-01-17 19:09:00 -08:00
Andrew Pareles d3647bf93c red lines above green 2025-01-17 19:02:46 -08:00
Mathew Pareles 29c4603909 fix spacing 2025-01-17 18:04:48 -08:00
Andrew Pareles 85426e28bd + 2025-01-17 17:59:11 -08:00
Andrew Pareles c6ff563e1b style 2025-01-17 17:54:09 -08:00
Andrew Pareles 7ec574eeee rm log 2025-01-17 17:45:44 -08:00
Andrew Pareles 66c880945c ctrlk settings handling 2025-01-17 17:43:21 -08:00
Andrew Pareles 6f1905a962 fix streaming issue, cleanup chat error styles 2025-01-17 17:32:49 -08:00
Mathew Pareles 268d2ae99a ux 2025-01-17 17:21:04 -08:00
Mathew Pareles 1521038e03 fixes 2025-01-17 16:56:48 -08:00
Andrew Pareles dce0378eb2 fix cancel streaming 2025-01-17 16:39:26 -08:00
Mathew Pareles ce7ee62abe remove old files 2025-01-17 15:49:36 -08:00
Andrew Pareles 015943329f misc 2025-01-16 23:58:57 -08:00
Mathew Pareles 4b15885147 summary styles 2025-01-16 21:38:06 -08:00
Mathew Pareles 2e3f608805 better history handling 2025-01-16 20:17:49 -08:00
Mathew Pareles 789016709a multiple prospective 2025-01-16 20:02:22 -08:00
Mathew Pareles 835a2bdf92 spacing 2025-01-16 17:10:32 -08:00
Mathew Pareles c02f1de758 fix spacing 2025-01-16 17:09:38 -08:00
Mathew Pareles ddd9cf857f ux 2025-01-16 03:31:17 -08:00
Mathew Pareles e4fd6d05a4 prospective file adding 2025-01-16 02:20:33 -08:00
Andrew Pareles 9756ab6d16 filter out empty thread 2025-01-15 23:52:32 -08:00
Andrew Pareles 433884b36c do not ignore version mismatch 2025-01-15 23:42:25 -08:00
Andrew Pareles 0d48db1a0c fix metrics 2025-01-15 23:17:05 -08:00
Andrew Pareles 10adc13b60 add manual device id 2025-01-15 22:57:17 -08:00
Andrew Pareles 2103a95930 VOID ICON - remove code-icon.svg 2025-01-15 22:42:46 -08:00
Andrew Pareles f8c454544c add logging of debug metrics 2025-01-15 20:53:41 -08:00
Andrew Pareles e3da020c0a bigger weight 2025-01-15 19:27:32 -08:00
Andrew Pareles 7dec57ae04 add high priority to void keybinds 2025-01-15 19:24:08 -08:00
Andrew Pareles f8db386c3b Update CONTRIBUTING.md 2025-01-15 18:45:24 -08:00
Andrew Pareles 2d583b87dc Merge pull request #212 from voideditor/model-selection
Latest updates
2025-01-15 18:38:51 -08:00
Andrew Pareles b9dba7d08b loading icon fix 2025-01-15 18:26:47 -08:00
Andrew Pareles 4e18dd4ac3 rename 2025-01-15 18:23:35 -08:00
Andrew Pareles 471333ec16 can have many streams at once! 2025-01-15 18:23:35 -08:00
Andrew Pareles d43453e5ed ui 2025-01-15 18:23:35 -08:00
Mathew Pareles 3abafa76ec fix cmd+k tabbing 2025-01-15 18:14:12 -08:00
Andrew Pareles e48e798afc bigger bar 2025-01-15 06:38:47 -08:00
Mathew Pareles 4619e4146a + 2025-01-15 06:07:54 -08:00
Mathew Pareles f522281c6d comment 2025-01-15 06:03:41 -08:00
Mathew Pareles 1e3668058b change aux bar min width 2025-01-15 06:03:20 -08:00
Mathew Pareles 88c921b059 minor 2025-01-15 06:00:00 -08:00
Mathew Pareles 8cfe494632 pair programming fix model refresh state 2025-01-15 05:59:38 -08:00
Andrew Pareles d4fc59034a add ai instructions, fix prompts 2025-01-15 05:25:46 -08:00
Mathew Pareles 9ba70cdc4a minor 2025-01-15 03:07:53 -08:00
Mathew Pareles 12d08eb709 maxheight increase 2025-01-15 02:47:00 -08:00
Mathew Pareles f3270a2219 add editor maxheight back 2025-01-15 02:45:27 -08:00
Mathew Pareles bd30f14980 add scrollbar styles to quickedit 2025-01-15 02:22:12 -08:00
Andrew Pareles 725de600cf schema !== 'file' for peek, and minor accept all state fix 2025-01-15 02:18:20 -08:00
Andrew Pareles ccfd54fcfe fix 2025-01-15 01:51:49 -08:00
Andrew Pareles 071c4893c2 add state for accept|reject all 2025-01-15 01:42:17 -08:00
Mathew Pareles 8f15c67960 acceptall rejectall ui 2025-01-15 01:27:27 -08:00
Mathew Pareles fd546ff7b7 starting point for accept|reject all 2025-01-15 00:04:24 -08:00
Andrew Pareles 895628bb91 comment 2025-01-14 23:15:54 -08:00
Andrew Pareles 4898875532 fix 2025-01-14 23:13:28 -08:00
Mathew Pareles 9ddc22b63c fix package.json 2025-01-14 19:58:36 -08:00
Andrew Pareles 44438fe1fe re-remove streaming state for nwo 2025-01-14 19:34:09 -08:00
Andrew Pareles 64e43fa53e fix ctrlK state 2025-01-14 19:14:32 -08:00
Mathew Pareles 07f4a59ce6 diff on redf 2025-01-14 18:36:23 -08:00
Andrew Pareles c7d5d5d183 fix streaming alignment 2025-01-14 16:57:08 -08:00
Andrew Pareles 9f96ebcfc2 fix lag by changing rendering process in red zones 2025-01-14 15:44:39 -08:00
Mathew Pareles 01839654d4 acceptall rejectall widget draft 2025-01-13 22:10:47 -08:00
Andrew Pareles 37200dacbd add metrics + streaming works pretty well! 2025-01-13 21:48:14 -08:00
Mathew Pareles 86612fd5ed accept/reject styles 2025-01-13 19:08:21 -08:00
Mathew Pareles 937816519c more spacing 2025-01-13 17:47:17 -08:00
Andrew Pareles 35e366a5ba rm testDiffs 2025-01-13 17:30:18 -08:00
Andrew Pareles d2fdbd7ffd date 2025-01-13 17:16:58 -08:00
Andrew Pareles 33a003fc2d get ready to release 2025-01-13 17:16:27 -08:00
Andrew Pareles 9589134830 modify changelog 2025-01-13 17:15:44 -08:00
Mathew Pareles 164684a39b input color 2025-01-13 17:00:49 -08:00
Andrew Pareles accff821f8 style fixes 2025-01-13 16:54:26 -08:00
Mathew Pareles 00fc9964e5 ts by default 2025-01-13 16:45:15 -08:00
Jérôme Commaret 4b8afc1771 Merge branch 'voideditor:main' into feat-mistral-new 2025-01-14 01:38:11 +01:00
Mathew Pareles 3e5ead2547 dropdown 2025-01-13 16:31:03 -08:00
Jérôme Commaret d067966b58 Merge branch 'model-selection' into feat-mistral-new 2025-01-13 23:31:19 +01:00
Jérôme Commaret 278c52bd35 Merging everything here 2025-01-13 22:48:43 +01:00
Andrew Pareles 52d89e5815 heursitc check 2025-01-13 04:23:34 -08:00
Andrew Pareles 4cf13b67b0 comment 2025-01-13 04:16:54 -08:00
Andrew Pareles fc327e3fcb colors 2025-01-13 04:16:16 -08:00
Andrew Pareles 59afe2d6ff fix with requestanimationframe 2025-01-13 04:14:43 -08:00
Andrew Pareles 1d590510ae mostly works!! tracethroughs would be insanely helpful... 2025-01-13 03:55:20 -08:00
Andrew Pareles c5a6f476ef cleanup 2025-01-13 03:55:20 -08:00
Andrew Pareles ae4ece1826 bug fixes and migrate to custom VoidInputBox2 2025-01-13 03:55:20 -08:00
Mathew Pareles ec2f04be91 merge temporary fix 2025-01-13 03:33:06 -08:00
Mathew Pareles 8a56ea9755 merge bug 2025-01-13 03:32:21 -08:00
Mathew Pareles 261736bde5 prepare edit button 2025-01-13 03:23:38 -08:00
Mathew Pareles 7dd5171bd2 empty threads 2025-01-12 19:31:37 -08:00
Mathew Pareles becd109776 empty tyhreaeds 2025-01-12 19:29:22 -08:00
Mathew Pareles 0d9f441967 fix spacing settings 2025-01-12 19:22:29 -08:00
Andrew Pareles 6386fc95ee misc 2025-01-12 19:10:33 -08:00
Andrew Pareles 06688228ae notif details 2025-01-12 19:03:10 -08:00
Mathew Pareles b3d2453e7f history style 2025-01-12 19:02:28 -08:00
Andrew Pareles 29e1f312c3 scroll to top on thread switch 2025-01-12 18:06:52 -08:00
Andrew Pareles b9b645522a improve changelog 2025-01-12 17:53:00 -08:00
Mathew Pareles 83bf660b76 md styles 2025-01-12 17:52:00 -08:00
Andrew Pareles 268f08c51d changelog 2025-01-12 17:30:35 -08:00
Andrew Pareles 046942be75 remove telemetry 2025-01-12 17:29:12 -08:00
Andrew Pareles 6fed97eb83 + 2025-01-12 15:42:21 -08:00
Mathew Pareles e888f261fe accept/reject on right 2025-01-12 03:58:44 -08:00
Andrew Pareles 6e8498414c add ability to test diffs 2025-01-12 03:49:35 -08:00
Andrew Pareles bcda1dbe2b don't let ctrlK overlap 2025-01-12 03:23:56 -08:00
Mathew Pareles be3128acb4 ctrlk styles 2025-01-12 03:14:59 -08:00
Andrew Pareles 29cbb15911 fix async race condition 2025-01-12 03:01:14 -08:00
Andrew Pareles 8da71dc1b7 jitter changes 2025-01-12 02:07:32 -08:00
Andrew Pareles a69b99b562 file tab switches only 2025-01-12 01:58:50 -08:00
Mathew Pareles 6868a8b1d8 fix menu ctrl+k 2025-01-12 01:23:49 -08:00
Mathew Pareles 10f8fcc17d language detection better 2025-01-11 22:37:31 -08:00
Mathew Pareles ee9f84a475 fix delete button 2025-01-11 19:12:38 -08:00
Mathew Pareles c056214684 prompt adjust 2025-01-11 18:12:21 -08:00
Mathew Pareles fcf03f2710 Merge branch 'model-selection' of https://github.com/voideditor/void into model-selection 2025-01-11 17:22:53 -08:00
Mathew Pareles ed50ed5319 get rid of delete 2025-01-11 17:18:33 -08:00
Andrew Pareles f15f5ce8ed clear button - styles 2025-01-11 17:15:42 -08:00
Mathew Pareles 11578d6288 clear all button 2025-01-11 16:48:59 -08:00
Mathew Pareles d904dbb93e clearall style 2025-01-11 16:25:44 -08:00
Andrew Pareles 6df0c0ac69 add tab switch listeners that account for visibility 2025-01-11 16:22:53 -08:00
Andrew Pareles 0f98af7fc1 ignore not compatible 2025-01-11 15:50:55 -08:00
Mathew Pareles e1b8e49b13 update metrics 2025-01-11 00:51:55 -08:00
Andrew Pareles e6f6c7500d update api comment 2025-01-10 23:57:44 -08:00
Mathew Pareles 951da8e31a merge 2025-01-10 19:02:53 -08:00
Jérôme Commaret 2701226ef3 Translate abort comments 2025-01-10 23:57:40 +01:00
Jérôme Commaret 9abc3ad3dc _aborter set 2025-01-10 23:46:58 +01:00
Andrew Pareles 966470cf68 fix icon for clear 2025-01-09 23:24:50 -08:00
Andrew Pareles b2cf709685 add clear button and increate prefix/suffix FIM length 2025-01-09 23:16:00 -08:00
Andrew Pareles ab0bf4bef0 ring inset 2025-01-09 22:45:42 -08:00
Andrew Pareles db20584a19 separate open sidebar from select for sidebar 2025-01-09 22:29:30 -08:00
Andrew Pareles 7d1d638dae add updater link 2025-01-09 22:22:34 -08:00
Andrew Pareles 0d1c4944c1 only open 1 editor 2025-01-09 21:22:44 -08:00
Andrew Pareles f7c4d28d55 toggle vs open settings 2025-01-09 21:20:09 -08:00
Mathew Pareles a2ae7a9674 Update README.md 2025-01-09 21:08:31 -08:00
Mathew Pareles 262e15764b Update README.md 2025-01-09 21:06:25 -08:00
Mathew Pareles 26f97f5939 Update README.md 2025-01-09 20:48:13 -08:00
Mathew Pareles a9dc35e5db Update README.md 2025-01-09 19:37:02 -08:00
Andrew Pareles 326dcae24f Merge remote-tracking branch 'origin/main' into model-selection 2025-01-09 18:59:45 -08:00
Andrew Pareles f880ddd6dc Merge pull request #211 from voideditor/lic
License
2025-01-09 18:53:42 -08:00
Andrew Pareles 7925e438c6 header update 2025-01-09 18:51:40 -08:00
Andrew Pareles 2f5e954ebf update 2025-01-09 18:49:05 -08:00
Andrew Pareles 6a8ac1a68e apache 2.0 2025-01-09 18:48:52 -08:00
Andrew Pareles c5b6fd9b75 Create temp 2025-01-09 18:48:15 -08:00
Andrew Pareles 7e68a485f2 misc 2025-01-09 18:15:51 -08:00
Jérôme Commaret af85949561 Merge branch 'main' into feat-mistral-new 2025-01-09 15:48:57 +01:00
Mathew Pareles a1da8bd12f settings improve 2025-01-09 03:59:41 -08:00
Andrew Pareles ebd78a902d misc 2025-01-09 03:58:18 -08:00
Andrew Pareles f96c03c846 fix scroll ctrlK 2025-01-09 03:55:16 -08:00
Andrew Pareles fed865e753 copy 2025-01-09 03:40:44 -08:00
Andrew Pareles 8d2917d331 more 2025-01-09 03:38:07 -08:00
Andrew Pareles f4c1fc8917 settings style updates 2025-01-09 03:38:07 -08:00
Mathew Pareles 0a3f31acae scrolbar 2025-01-09 03:27:39 -08:00
Mathew Pareles 924c953697 setttings minwidth 2025-01-09 03:24:30 -08:00
Andrew Pareles 446dede5e4 refreshes ollama only 2025-01-09 02:52:18 -08:00
Andrew Pareles 7bb0993249 transfer button feedback 2025-01-09 02:48:48 -08:00
Andrew Pareles 4968452003 proper warning 2025-01-09 02:22:54 -08:00
Andrew Pareles 037f9f38e5 one click switch 2025-01-09 02:17:29 -08:00
Mathew Pareles e132c87792 generalize for @andrew 2025-01-09 02:15:52 -08:00
Mathew Pareles 07d87c8bf0 styles 2025-01-09 01:56:36 -08:00
Mathew Pareles c7ad7d3761 fix dropdown 2025-01-09 01:53:05 -08:00
Mathew Pareles ff9d21eee0 fix dropdown 2025-01-09 01:50:11 -08:00
Mathew Pareles e4953057ef color improvements 2025-01-09 01:50:11 -08:00
Mathew Pareles 865c34f282 new model dropdown draft 2025-01-09 01:50:11 -08:00
Andrew Pareles ec65903692 misc 2025-01-08 21:07:54 -08:00
Andrew Pareles a08e6078f2 reject diffarea and cleanup 2025-01-08 19:32:44 -08:00
Andrew Pareles 20e1b287f8 scrollbar settings 2025-01-08 19:32:44 -08:00
Mathew Pareles f2f9b6ccca context fits in inputbox 2025-01-08 17:38:54 -08:00
Andrew Pareles c4e4701dc3 placeholder 2025-01-08 17:12:39 -08:00
Andrew Pareles 37af31f958 minor comment 2025-01-08 16:30:38 -08:00
Mathew Pareles b5dff4cf0f selection bug fix 2025-01-08 03:04:19 -08:00
Mathew Pareles 3621bb63f4 wrap 2025-01-08 02:58:27 -08:00
Mathew Pareles da247c6ed4 color 2025-01-08 01:46:54 -08:00
Mathew Pareles ce634eadaa better styles 2025-01-08 00:14:57 -08:00
Mathew Pareles 910ed7faa9 fix scrollbar bug 2025-01-07 22:48:32 -08:00
Andrew Pareles 9e852355d9 add important tags to build files 2025-01-07 22:35:34 -08:00
Mathew Pareles 8ae4700bb2 fix to annoying out of order import problem 2025-01-07 22:28:14 -08:00
Mathew Pareles f13c30ae0d refactor blockcode 2025-01-07 21:02:59 -08:00
Mathew Pareles af244938b8 refactor blockcode 2025-01-07 20:39:24 -08:00
Andrew Pareles a53f92432b keybinding for ctrl+L and ctrl+K shows accurately even if user changes it 2025-01-07 19:45:41 -08:00
Mathew Pareles ca2b18d9da scrollbar styles recursive 2025-01-07 00:33:27 -08:00
Mathew Pareles 5293095eb8 custom scrollbar 2025-01-06 23:11:52 -08:00
Andrew Pareles 4e392bee8e start adding icons for copying files and folders in the explorer 2025-01-06 22:25:41 -08:00
Mathew Pareles 86346f1bf0 scrollbars 2025-01-06 19:15:41 -08:00
Mathew Pareles a0672f845d selection ui 2025-01-06 18:38:53 -08:00
Andrew Pareles f96d320ce0 fix tricky reject bug 2025-01-06 02:02:48 -08:00
Andrew Pareles bb7e69b20b small fix for realigning 2025-01-06 01:43:54 -08:00
Andrew Pareles f19e579ce9 extract code works! ignore </MID> etc 2025-01-06 01:19:27 -08:00
Andrew Pareles dd133d2cd5 ctrlK roundRange 2025-01-05 21:27:16 -08:00
Andrew Pareles 2ba04a78a8 add X to ctrlK 2025-01-05 21:02:31 -08:00
Andrew Pareles fb948b331f ctrlK 2025-01-05 18:03:36 -08:00
Raz Luvaton 5083b8e971 fix react build.js to properly find the base folder (#203) 2025-01-05 18:00:40 -08:00
Mathew Pareles 35091eb8f2 change wording 2025-01-05 17:11:10 -08:00
Mathew Pareles b9e61bf4e2 styles 2025-01-05 17:10:20 -08:00
Andrew Pareles 55ec3365a2 empty seln 2025-01-05 17:04:07 -08:00
Mathew Pareles d6811e872a fix color 2025-01-05 16:57:39 -08:00
Mathew Pareles c176b8020f styles 2025-01-05 16:35:43 -08:00
Andrew Pareles 85c2c80db0 Update README.md 2025-01-04 23:55:52 -08:00
Andrew Pareles b677d3dfc1 Update CONTRIBUTING.md 2025-01-03 17:18:18 -08:00
Andrew Pareles 6dcf684429 updateService changes 2025-01-03 17:11:18 -08:00
Mathew Pareles 26ddd6418c extract <MID> result 2025-01-03 16:54:04 -08:00
Andrew Pareles cc177b9cd4 update package 2025-01-03 14:14:37 -08:00
Andrew Pareles dd204978e5 update lock 2025-01-03 13:31:54 -08:00
Andrew Pareles fb48c4e67e Update VOID_USEFUL_LINKS.md 2025-01-03 13:15:55 -08:00
Andrew Pareles 74fa5cb505 Merge pull request #202 from PraveenAsh/patch-1
Update CONTRIBUTING.md
2025-01-03 12:44:33 -08:00
Andrew Pareles fae03c3060 Update CONTRIBUTING.md 2025-01-03 12:44:12 -08:00
Jérôme Commaret 5453acdb19 Mistral : update 2025-01-03 20:21:46 +01:00
Jérôme Commaret 7047459e57 Merge branch 'main' into feat-mistral-new 2025-01-03 19:57:34 +01:00
Praveen Naik 68722ee5c3 Update CONTRIBUTING.md
Added details about Bundling output. Most of us open only the repo without workspace to save memory. It's easy to miss out on where the bundle is located. Added clarity
2025-01-03 21:04:54 +05:30
Mathew Pareles cffe558cf5 code editor bg 2025-01-03 01:35:36 -08:00
Mathew Pareles 9bc551f0ac code editor bg 2025-01-03 01:35:36 -08:00
Mathew Pareles 01d7878671 code editor bg 2025-01-03 01:31:47 -08:00
Mathew Pareles 2519f094cc input and dropdown styles 2025-01-03 00:00:03 -08:00
Andrew Pareles 4a993a716b Update README.md 2025-01-02 23:34:37 -08:00
Andrew Pareles 23d1d4169a update CONTRIBUTING.md 2025-01-02 23:20:36 -08:00
Andrew Pareles f688e1ffae Update LICENSE-VS-Code.txt 2025-01-02 23:06:06 -08:00
Andrew Pareles a443315c14 Merge branch 'main' of https://github.com/voideditor/void 2025-01-02 23:02:05 -08:00
Andrew Pareles eeacb2d3c9 separate licenses + header 2025-01-02 23:00:59 -08:00
Andrew Pareles cdbdf3c5c7 License update (#199) 2025-01-02 22:58:05 -08:00
Andrew Pareles 825c40bfff license 2025-01-02 22:40:43 -08:00
Andrew Pareles a72305819a copy 2025-01-02 19:15:08 -08:00
Andrew Pareles a3d3309b9d Merge pull request #197 from voideditor/model-selection
Fix line indexing for CtrlK
2025-01-02 18:59:08 -08:00
Andrew Pareles 32bfe9a111 fix line indexing when streaming 2025-01-02 18:58:44 -08:00
Andrew Pareles a9adcad560 misc 2025-01-02 17:57:38 -08:00
Mathew Pareles 80f7511eee default settings instructions 2025-01-02 17:34:31 -08:00
Andrew Pareles 7fe8f5c47d ctrlK line numbers are right 2025-01-02 17:26:28 -08:00
Mathew Pareles b31882565b fix watchreact 2025-01-02 17:11:32 -08:00
Andrew Pareles 6aaf425419 Settings update + ctrlK stream runs (but is broken) 2025-01-02 17:10:38 -08:00
Andrew Pareles b0d21dfdb1 Merge pull request #196 from voideditor/model-selection
misc necessary updates
2025-01-02 16:41:33 -08:00
Andrew Pareles 2087948789 misc necessary updates 2025-01-02 16:40:55 -08:00
Andrew Pareles 6feb713682 Merge pull request #192 from jcommaret/main
Fix - bundle - ajv missing deps
2025-01-02 16:31:45 -08:00
Andrew Pareles 667dc8bd7e merge 2025-01-02 16:31:29 -08:00
Andrew Pareles bdb0c65346 Merge pull request #195 from voideditor/model-selection
Merge model selection branch (ctrlK, model selection, UI)
2025-01-02 16:29:10 -08:00
Andrew Pareles df14b80d8b not sure where this came from 2025-01-02 16:28:33 -08:00
Andrew Pareles 86decf8ed9 add (c) headers 2025-01-02 16:27:06 -08:00
Andrew Pareles bd9b9a9058 minor updates 2025-01-02 16:20:19 -08:00
Mathew Pareles 83c1f3430a fix assistant chat 2025-01-02 15:51:00 -08:00
Andrew Pareles 02de8937ac update copy 2025-01-02 01:28:19 -08:00
Mathew Pareles 78f3819c33 move extractCodeFromResult 2025-01-01 23:19:16 -08:00
Mathew Pareles b9cea4906e fix chat bubble direction 2025-01-01 23:08:32 -08:00
Mathew Pareles 4a4677b5e2 center button; fix single line button 2025-01-01 22:35:48 -08:00
Andrew Pareles 5dab1a6a77 update product.json 2025-01-01 22:05:57 -08:00
Mathew Pareles 9b01d5ba7c minor changes 2025-01-01 21:28:44 -08:00
Mathew Pareles dcb708758d fix input resize 2025-01-01 21:28:44 -08:00
Andrew Pareles dd4548466a minor chagnes 2025-01-01 20:01:10 -08:00
Andrew Pareles cda489e3e0 small fixes 2025-01-01 05:04:51 -08:00
Andrew Pareles 13594ef06c rework copy 2025-01-01 04:57:10 -08:00
Andrew Pareles c2b8df06eb desc 2025-01-01 04:47:41 -08:00
Andrew Pareles 33809ec48b finish adding css 2025-01-01 04:44:43 -08:00
Andrew Pareles b4820abc9e css 2025-01-01 04:31:44 -08:00
Andrew Pareles 0e79dec0d7 VOID ICONS 2024-12-31 22:03:38 -08:00
Andrew Pareles 659f01413f misc + track down icons to change 2024-12-31 20:27:31 -08:00
Andrew Pareles 110534df30 memo model dropdown + add ability to remove ctrlK zone 2024-12-31 16:18:18 -08:00
Andrew Pareles d3b61867f0 ctrlK now switches tabs + UI + remove async 2024-12-31 15:41:24 -08:00
Andrew Pareles 954e611fda Merge branch 'new-services' into model-selection 2024-12-31 13:56:07 -08:00
Andrew Pareles 64760aae13 comment 2024-12-31 13:54:08 -08:00
Andrew Pareles d0d1124543 delete old files 2024-12-31 13:47:41 -08:00
Andrew Pareles 90a3fd0a21 merge 2024-12-31 13:45:48 -08:00
Andrew Pareles 11ed2545c7 Merge remote-tracking branch 'origin/main' into new-services 2024-12-31 13:40:20 -08:00
Andrew Pareles 3d1df92f6a re-add deletion logic 2024-12-31 13:39:31 -08:00
Andrew Pareles 4ca16caa4e fix misc history issues with ctrlk - looks good!!! 2024-12-31 02:24:34 -08:00
Andrew Pareles 06b5cca59a history snapshot is only for this URI 2024-12-30 23:29:05 -08:00
Andrew Pareles e3c292eee7 progress towards ctrlK 2024-12-30 22:14:55 -08:00
Andrew Pareles 99c3786d06 diffarea resize logic 2024-12-30 19:37:52 -08:00
Andrew Pareles 6e40a92315 add FIM streaming + instructions 2024-12-30 15:20:55 -08:00
Andrew Pareles a9b2ff631d ctrlK progress... 2024-12-30 03:04:32 -08:00
Mathew Pareles 198adaaf18 selection ui 2024-12-30 04:57:43 -05:00
Mathew Pareles 2df7fa9ebc better model selection 2024-12-30 04:36:31 -05:00
Mathew Pareles 312942b004 ollama instructions 2024-12-30 03:39:17 -05:00
Mathew Pareles 0a444f6ff8 mark if model is detected locally 2024-12-30 01:45:02 -05:00
Mathew Pareles 0c10cb73f6 fix polling enable bug 2024-12-29 23:45:46 -05:00
Andrew Pareles ef8bba00b9 update ctrlk 2024-12-29 19:16:16 -08:00
Mathew Pareles 3a3bc24fef better polling state 2024-12-29 05:07:52 -05:00
Andrew Pareles ff7830e704 resize observer mostly works 2024-12-28 22:30:46 -05:00
Andrew Pareles 01a345a391 ctrlk double redundancy fix 2024-12-28 21:28:20 -05:00
Andrew Pareles 33909b3143 add ctrl+K 2024-12-28 20:03:47 -05:00
Jérôme Commaret 9543bf8eb3 Fix : Ajv missing deps at bundle 2024-12-28 22:19:16 +01:00
Andrew Pareles 9a9d0da91e remove errors 2024-12-27 23:56:24 -05:00
Jérôme Commaret 4065c5b504 Mistral implementation : Working 2024-12-27 16:37:27 +01:00
Jérôme Commaret 4729e4dac3 Mistral v2 2024-12-27 14:46:02 +01:00
Jérôme Commaret d85a316536 Merge branch 'voideditor:main' into main 2024-12-27 13:59:49 +01:00
Andrew Pareles 1df044fb02 Update product.json 2024-12-25 22:23:01 -05:00
Mathew Pareles 076e0add44 prepare large merge 2024-12-25 19:21:16 -08:00
Andrew Pareles dfbd729fa4 nightly progress 2024-12-24 23:45:58 -05:00
Mathew Pareles 8a17c9246b language logic 2024-12-24 17:34:18 -08:00
mp 1afb39b155 minor changes 2024-12-24 02:22:45 -08:00
mp f08fd04af5 autodetect language 2024-12-23 16:21:37 -08:00
Andrew Pareles ef9d0daef4 minor chat styles 2024-12-23 15:37:06 -08:00
Andrew Pareles ffe5a41b01 fix rounding 2024-12-23 04:33:49 -08:00
Andrew Pareles 372beb7a2d rm temp 2024-12-23 03:30:05 -08:00
Andrew Pareles 406f29bb5a + 2024-12-23 03:29:49 -08:00
Andrew Pareles ee8b98ff74 minor changes 2024-12-23 03:00:19 -08:00
Andrew Pareles ffb0549c7c update zoneStyleService 2024-12-23 03:00:19 -08:00
Andrew Pareles 8f9c2f0630 misc 2024-12-23 03:00:19 -08:00
Andrew Pareles 84bfc26dce debugging 2024-12-23 03:00:10 -08:00
Andrew Pareles 80a87ff3c6 improvements but might still be buggy 2024-12-23 02:43:19 -08:00
mp 806ec939e5 ux for providers 2024-12-23 02:34:23 -08:00
Andrew Pareles 98a22d2eb6 minor changes 2024-12-23 00:16:37 -08:00
Andrew Pareles ffa31bc289 update zoneStyleService 2024-12-23 00:14:54 -08:00
Andrew Pareles a1ab8a5796 misc 2024-12-22 23:52:21 -08:00
mp 70c7d0261c correct bg 2024-12-22 21:41:37 -08:00
mp e7af8d9448 selection style 2024-12-22 21:28:09 -08:00
mp e1feaba74a warning icon 2024-12-22 02:12:24 -08:00
mp 8456f979ba warning icon 2024-12-22 02:07:29 -08:00
Andrew Pareles 6630d596f6 code box UI 2024-12-21 22:43:34 -08:00
Andrew Pareles a435a59a2e inlineDiffEdits add support for ctrl+K 2024-12-21 22:40:08 -08:00
mp 9cf4980004 selection 2024-12-21 22:37:08 -08:00
Mathew Pareles 6298be394d indentation 2024-12-21 21:13:21 -08:00
Andrew Pareles e647ce0054 fix + mount sidebar on init 2024-12-21 18:46:45 -08:00
Andrew Pareles 5fb30fed87 sidebar action 2024-12-21 18:29:15 -08:00
mp 7cc57bf086 input styles 2024-12-21 18:19:19 -08:00
Andrew Pareles 3fb6a4890d watermark 2024-12-21 17:51:15 -08:00
mp 97fd332c4e add code editor block 2024-12-21 17:29:02 -08:00
Andrew Pareles 81282e16b3 minor contrib update 2024-12-21 00:15:14 -08:00
Andrew Pareles 382275fa9f delete built-in extensions so the build works 2024-12-21 00:00:57 -08:00
Andrew Pareles 91f8321278 delete autoenable 2024-12-20 02:08:30 -08:00
Andrew Pareles 9b1f21d7c1 Merge pull request #185 from voideditor/model-selection
Daily UI improvements
2024-12-20 02:07:49 -08:00
Andrew Pareles 739ac2562b protected fix 2024-12-19 22:44:29 -08:00
Andrew Pareles 298423928e update styles and descs 2024-12-19 18:44:26 -08:00
mp 702d11ed3e Merge branch 'polishing-changes' into model-selection 2024-12-19 17:09:01 -08:00
Andrew Pareles 4513b732d6 all changes 2024-12-19 17:07:58 -08:00
Andrew Pareles 78e72f0c80 300 2024-12-19 17:00:16 -08:00
Andrew Pareles f457f006fb settings page styles 2024-12-19 04:05:31 -08:00
mp d6074e7ab5 ctrlk draft 2024-12-19 02:14:26 -08:00
Andrew Pareles 3669401819 upgrade to switches 2024-12-19 01:28:43 -08:00
Joaquin Coromina 1e975ecc3b Merge branch 'react-build-watcher' into react-build-improvements
Adding react build improvements to the proper branch#
2024-12-19 15:22:07 +08:00
Joaquin Coromina 8476a99903 Added watchreactd to tasks.json so that when using build hotkey (cmd/ctrl + shift + B) it includes watchreactd automatically 2024-12-19 15:10:42 +08:00
Joaquin Coromina 85314f8d47 Updated watch script to include watchreact, and added watchreactd 2024-12-19 15:09:16 +08:00
Andrew Pareles ee7d0ed836 Merge pull request #181 from bjoaquinc/react-build-watcher
Fix React build crashing watch-client and added watch mode
2024-12-18 19:45:24 -08:00
Andrew Pareles ba87b4f0de update contrib 2024-12-18 19:40:27 -08:00
Andrew Pareles e4bc21ffb1 Merge pull request #182 from voideditor/model-selection
UI Improvements and Model Selection
2024-12-18 19:33:57 -08:00
Andrew Pareles 81b78b7765 auto fetch model works 2024-12-18 19:31:50 -08:00
Andrew Pareles c3c53b5e81 slightly fix refresh state 2024-12-18 16:48:04 -08:00
Andrew Pareles f49a6f8e41 minor style changes and refresh model works in general 2024-12-18 16:06:53 -08:00
mp 5a26aa8746 Merge branch 'model-selection' into polishing-changes 2024-12-18 15:45:18 -08:00
Andrew Pareles 8661fe1417 fix selection styles and add void watermark (buttons look bad) 2024-12-18 13:35:34 -08:00
Joaquin Coromina 2a519157da Merge remote-tracking branch 'origin/react-build-watcher' into recovered-code
Added a watcher that syncs react with watch-client without crashing#
2024-12-18 18:47:37 +08:00
mp ac8365def4 ctrl+L 2024-12-18 02:29:11 -08:00
Joaquin Coromina 610b52587b Added watchreact npm command, resolved watch-client crashes during updates, and included nodemon as a dependency 2024-12-18 18:24:17 +08:00
mp 01efab6a1d cmd+L prompt 2024-12-17 19:30:14 -08:00
Andrew Pareles 7f8e1ff00d Merge pull request #180 from voideditor/model-selection
Misc UI Improvements
2024-12-17 18:16:07 -08:00
Andrew Pareles 5b55eed08a threads styles + misc 2024-12-17 18:15:09 -08:00
Andrew Pareles d618223289 misc improvements. need to add max h on thread histroy 2024-12-17 01:55:32 -08:00
Andrew Pareles 7752278720 settings styles 2024-12-17 01:33:33 -08:00
Andrew Pareles 597c04f63b settings UI 2024-12-16 23:08:01 -08:00
mp a7c4a1b179 input box style 2024-12-16 23:02:33 -08:00
Andrew Pareles a7aab9cf86 some UI for models! 2024-12-16 21:49:03 -08:00
Andrew Pareles c44497510b add responsive dark mode 2024-12-16 18:57:28 -08:00
Andrew Pareles c485d2c478 react updates 2024-12-16 17:43:07 -08:00
Andrew Pareles dfdf29fb36 rename 2024-12-16 15:05:49 -08:00
Andrew Pareles 420fb1a186 icon is incredibly annoying 2024-12-16 01:21:55 -08:00
Andrew Pareles 78a48bae13 add model selection 2024-12-16 00:17:50 -08:00
mp fc187e0028 sidebar scrolllock 2024-12-15 23:06:25 -08:00
mp f973f8d4e7 fix selection range bug 2024-12-15 22:24:16 -08:00
Andrew Pareles 8403eed8ca fix hook 2024-12-15 21:42:31 -08:00
Andrew Pareles 718b8cc61b add void settings in lower left 2024-12-15 21:10:17 -08:00
mp f6924df09b Fix rerenders 2024-12-15 20:52:43 -08:00
Andrew Pareles 8b25f80e9b model selection is accurate now, and lots of files moved to be more accurate 2024-12-15 20:43:11 -08:00
mp a42ff2d59a sidebar + ux 2024-12-15 01:33:02 -08:00
Andrew Pareles 0589a2a5ec remove maxtokens 2024-12-15 01:11:07 -08:00
Andrew Pareles 7dda4bdc08 add editor pane 2024-12-15 00:30:21 -08:00
Andrew Pareles f21ef61677 .js fix 2024-12-14 21:19:49 -08:00
Andrew Pareles 56b6d406d6 Merge remote-tracking branch 'origin/main' into model-selection 2024-12-14 21:16:43 -08:00
Andrew Pareles 2ae29a50e5 fix 2024-12-14 21:16:16 -08:00
mp 9673e974ea rename + merge 2024-12-14 20:47:27 -08:00
mp 842d388669 multiple selections 2024-12-14 20:39:50 -08:00
Andrew Pareles f146385e1d Update CONTRIBUTING.md 2024-12-14 20:17:30 -08:00
Andrew Pareles bb87726b34 Update CONTRIBUTING.md 2024-12-14 20:15:15 -08:00
Andrew Pareles deb30b49bc Update CONTRIBUTING.md 2024-12-14 19:51:28 -08:00
Andrew Pareles 56923eec52 Update CONTRIBUTING.md 2024-12-14 19:50:16 -08:00
Andrew Pareles d2692d2594 Update CONTRIBUTING.md 2024-12-14 19:47:44 -08:00
Andrew Pareles 5d44fdc17d Update CONTRIBUTING.md 2024-12-14 19:47:21 -08:00
Andrew Pareles aada60c5be Update CONTRIBUTING.md 2024-12-14 19:45:45 -08:00
Andrew Pareles b53e5d4886 Update CONTRIBUTING.md 2024-12-14 19:45:37 -08:00
Andrew Pareles f299998994 Update CONTRIBUTING.md 2024-12-14 19:41:18 -08:00
Andrew Pareles 967292e615 Update CONTRIBUTING.md 2024-12-14 19:31:37 -08:00
Andrew Pareles 19e3ebefda misc 2024-12-14 18:07:56 -08:00
Andrew Pareles 7cf6c9d798 Merge pull request #175 from voideditor/model-selection
Minor Contrib.md changes
2024-12-14 18:04:37 -08:00
Andrew Pareles 14e314e5b8 update contrib 2024-12-14 18:03:50 -08:00
Andrew Pareles 4e6e0b3bde Merge pull request #172 from voideditor/model-selection
Model selection
2024-12-14 17:58:38 -08:00
Andrew Pareles 63b086b786 dummy commit 2024-12-14 17:55:44 -08:00
Andrew Pareles bda6ad06c9 Merge branch 'main' into model-selection 2024-12-14 17:53:38 -08:00
Andrew Pareles 829d82850d rename Secondary Side Bar to Void Side Bar 2024-12-14 17:51:21 -08:00
Andrew Pareles 3991372f5b misc improvements 2024-12-14 17:51:07 -08:00
Andrew Pareles 9b427c78bf fix react state sync bug 2024-12-13 01:28:55 -08:00
Andrew Pareles 5dad4c8f06 relevant ollama update vals 2024-12-13 01:05:33 -08:00
Andrew Pareles e2d39fe4b1 ollama refreshes! 2024-12-13 00:41:34 -08:00
Andrew Pareles 1365400f21 llmMessageService now multiplexes between sendLLMMessage, ollama, etc 2024-12-12 19:30:45 -08:00
Andrew Pareles 94f4d2caaf add ollamaList to llmMessageService 2024-12-12 19:30:45 -08:00
Andrew Pareles 696abc39fd add ollama model fetcher, but proxy ignores its functions 2024-12-12 19:30:45 -08:00
mp abc7151cd6 Merge branch 'model-seln-2' into model-selection 2024-12-12 16:50:37 -08:00
Andrew Pareles c86f47743e update links 2024-12-12 16:42:48 -08:00
Andrew Pareles 9d6eb62c3e revert accidental change 2024-12-12 16:31:21 -08:00
Andrew Pareles 2f26b34a96 remove connect-src * that was introduced in testing 2024-12-12 16:25:23 -08:00
Andrew Pareles 5807c94a61 tailwind 2024-12-12 14:49:36 -08:00
Andrew Pareles df23314bd2 add css to useful links 2024-12-12 14:37:54 -08:00
Andrew Pareles 6703aa1545 get ready to sync ollama models 2024-12-12 01:42:06 -08:00
mp aaab289ece native tailwind colors 2024-12-12 01:10:52 -08:00
Andrew Pareles d809839530 add dummy models 2024-12-11 21:30:13 -08:00
Andrew Pareles 9e583960ae visual improvements 2024-12-11 21:17:24 -08:00
Andrew Pareles 19737d4cdc minor display change 2024-12-11 20:06:16 -08:00
mp 901579a445 Merge remote-tracking branch 'origin/model-selection' into model-seln-2 2024-12-11 20:04:37 -08:00
mp 051f8f38e7 Sidebar restructure 2024-12-11 20:02:07 -08:00
Andrew Pareles 07fcb3a72c better model seln UI + error handling works much better! 2024-12-11 19:53:36 -08:00
Jérôme Commaret 2d80a29275 Merge branch 'voideditor:main' into main 2024-12-12 01:03:51 +01:00
Andrew Pareles 62cdaba44b npm run react 2024-12-11 02:57:17 -08:00
Andrew Pareles 3147a92463 Update VOID_USEFUL_LINKS.md 2024-12-11 02:53:59 -08:00
Andrew Pareles d175ac20ef try dropdownmenu; didn't work 2024-12-11 02:40:19 -08:00
Andrew Pareles 42a2dec781 minor welcome changes 2024-12-11 02:19:22 -08:00
Andrew Pareles dbef72c01c update scope-tailwind to support -pr-5 2024-12-11 02:04:33 -08:00
Andrew Pareles 6ddf977c5d select box style 2024-12-11 01:47:57 -08:00
Andrew Pareles 522f136872 license comment 2024-12-11 01:28:55 -08:00
Andrew Pareles a28194c601 add sync state for dropdown 2024-12-11 01:24:04 -08:00
Andrew Pareles cb2de5505b fix 2024-12-11 00:49:52 -08:00
Andrew Pareles f84c964d10 finished model selection 2024-12-11 00:48:48 -08:00
Andrew Pareles bb4f99f687 error state, sendLLMMessage fix, continue adding state for provider/model pair selection 2024-12-10 23:29:39 -08:00
Andrew Pareles 49b43820b2 state - pick a provider/model 2024-12-10 23:24:36 -08:00
Andrew Pareles b22bbf9639 add not recommended line 2024-12-10 19:03:42 -08:00
Andrew Pareles a1ff458007 add deps and remove devDeps 2024-12-10 19:02:17 -08:00
Andrew Pareles fb263f9d81 update contrib for bundling 2024-12-10 17:54:58 -08:00
Andrew Pareles 72deba43dd consistent error messages 2024-12-10 17:41:13 -08:00
mp 24fdb1ca0d minor changes 2024-12-10 17:29:55 -08:00
Andrew Pareles f20f41c804 minor 'true' update 2024-12-10 02:42:32 -08:00
Andrew Pareles 66037e2049 update init state properly 2024-12-10 02:39:30 -08:00
Andrew Pareles adb504f2e0 reactify Widget 2024-12-10 02:09:06 -08:00
Andrew Pareles 8b90d7827d un-delete void channels 2024-12-10 00:25:06 -08:00
mp 62e1657274 change config key + merge 2024-12-09 19:45:49 -08:00
Andrew Pareles 7f776eebdb minor key 2024-12-09 19:45:37 -08:00
Andrew Pareles 0db0513752 finish merge errors 2024-12-09 19:25:54 -08:00
Andrew Pareles d8b6b3c306 Merge branch 're-add-autocomplete' into model-seln-2 2024-12-09 19:12:57 -08:00
Andrew Pareles f7c9d732f5 update type info 2024-12-09 19:01:08 -08:00
Andrew Pareles 8a95b13711 minor changes 2024-12-09 17:03:29 -08:00
Andrew Pareles 55884ed1c9 checkbox 2024-12-09 16:45:03 -08:00
Andrew Pareles 582b25dc44 build works 2024-12-09 16:26:31 -08:00
mp 252af4c863 build script 2024-12-09 16:17:53 -08:00
Andrew Pareles e5ac36facd add new config type for each feature, UI dump 2024-12-09 02:41:27 -08:00
Andrew Pareles 77fc2d2d4a temp 2024-12-08 18:44:04 -08:00
Andrew Pareles 298adac06e fix input box 2024-12-08 17:57:48 -08:00
Andrew Pareles 0f920fb867 remove void Widget inputs for now 2024-12-07 17:20:02 -08:00
Jérôme Commaret d8e9b50890 Advanced builder section added 2024-12-07 14:49:28 +01:00
mp 02112fbc4f allow selection by feature + provider (incomplete) 2024-12-07 00:28:13 -08:00
mp 05241649ff comment grep + _uiConfig change 2024-12-06 18:16:18 -08:00
Andrew Pareles 4ba00f6216 scope-tailwind doc 2024-12-06 02:55:28 -08:00
Andrew Pareles 296cd1b477 Update CONTRIBUTING.md 2024-12-06 02:51:30 -08:00
Andrew Pareles 2148fe77ec forgot to remove these 2024-12-06 01:33:10 -08:00
Andrew Pareles 1f692ff01a update contributing 2024-12-06 01:22:47 -08:00
Andrew Pareles 8e4f943e30 move node to electron-main, leaving react stuff in contrib/ 2024-12-06 01:03:43 -08:00
Andrew Pareles a52eba91c9 react updates 2024-12-05 22:57:55 -08:00
mp 695d6a1e30 Disable autocomplete 2024-12-05 19:52:05 -08:00
Andrew Pareles a647530d77 add native input selection in settings 2024-12-05 01:17:05 -08:00
Andrew Pareles 18e3f19512 inputbox ref is now an internal widget (and works better!) 2024-12-04 23:49:45 -08:00
Andrew Pareles 86294c676a fix copy 2024-12-04 23:48:37 -08:00
Andrew Pareles 7cfd9e5580 better msg display 2024-12-04 22:07:25 -08:00
Andrew Pareles d29eca457a fix 0 2024-12-04 21:43:03 -08:00
Andrew Pareles 0855376e02 update message display 2024-12-04 21:36:33 -08:00
Andrew Pareles e1692758c6 ui improvements - abort fix 2024-12-04 20:47:41 -08:00
Andrew Pareles 411167ee44 Merge remote-tracking branch 'origin/main' into ui-improvements 2024-12-04 19:02:47 -08:00
Andrew Pareles 389efb4701 fix scroll 2024-12-04 18:54:05 -08:00
mp 48f9ac2ba1 Minor changes 2024-12-04 18:50:09 -08:00
mp f9198d4d97 Remove accepted autocomplete characters 2024-12-04 17:50:24 -08:00
Andrew Pareles eafc3dc0c9 Merge pull request #144 from pythons/feature/llm_provider
refactor: modularize LLM providers and types
2024-12-04 15:12:59 -08:00
Andrew Pareles f2b176dfda remove extensions/ code 2024-12-04 15:12:45 -08:00
Andrew Pareles 02781927e1 Merge branch 'main' into pr/pythons/144 2024-12-04 15:11:42 -08:00
Andrew Pareles 4b3f881e1f rm comment 2024-12-04 15:08:40 -08:00
Andrew Pareles f3653c1c48 clarify config access 2024-12-04 15:07:11 -08:00
Andrew Pareles 3a1955901e move natively 2024-12-04 14:46:36 -08:00
Andrew Pareles e3ce68d2d6 Merge remote-tracking branch 'origin/main' into pr/pythons/144 2024-12-04 14:26:23 -08:00
Andrew Pareles ab3d44387e Merge pull request #141 from Piyu-Pika/Gemini
Add Groq
2024-12-04 14:20:38 -08:00
Andrew Pareles 96e24a89e6 re-remove extension package.json 2024-12-04 14:19:42 -08:00
Andrew Pareles 25cc6aeb3b add readme 2024-12-04 14:18:51 -08:00
Andrew Pareles 4cac92689a integrate into codebase 2024-12-04 14:16:34 -08:00
Piyush Bhardwaj 7444488278 Merge branch 'main' into pr/Piyu-Pika/141 2024-11-27 16:03:59 +05:30
mp a6cf723dbe Fix space issue 2024-11-26 19:01:38 -08:00
Andrew Pareles 7e22b80986 Merge pull request #161 from voideditor/docs-improvements
Improve documentation
2024-11-26 16:39:46 -08:00
Andrew Pareles 9ec4f3da01 void useful links update 2024-11-26 16:39:01 -08:00
mp ef9ac7a9e3 Merge branch 'main' into re-add-autocomplete 2024-11-26 16:30:38 -08:00
mp 48426403f3 Re-added autocomplete 2024-11-26 15:15:05 -08:00
Andrew Pareles 86c9a17f8d improve message 2024-11-26 02:59:16 -08:00
Andrew Pareles d21f2c4d62 fix file capitalization part 2 2024-11-26 02:52:20 -08:00
Andrew Pareles 733256feab fix file capitalization part 1 2024-11-26 02:51:56 -08:00
Andrew Pareles f9ce9de316 Merge pull request #159 from voideditor/fix-cors
Fix CORS + CSP
2024-11-26 02:22:57 -08:00
Andrew Pareles 9f27b17f11 ignore e.stack 2024-11-26 02:22:05 -08:00
Andrew Pareles 8ff4f1c6e1 update error handling 2024-11-26 02:16:57 -08:00
Andrew Pareles f6f6259f23 fix error handling 2024-11-26 01:55:42 -08:00
Andrew Pareles c7e9175fd7 add ability to abort 2024-11-26 01:08:25 -08:00
Andrew Pareles bdc3c9cb7e proxy works! 2024-11-26 00:41:31 -08:00
Andrew Pareles 790a2b6a4f llm messages work! sent from node! 2024-11-26 00:25:47 -08:00
Andrew Pareles e6c779d91a progress 2024-11-24 23:43:10 -08:00
Andrew Pareles aa95ceafd2 proxy to node appears to work!! 2024-11-24 20:39:15 -08:00
Andrew Pareles 9ef1aa2c60 fix cors progress 2024-11-24 20:28:54 -08:00
Andrew Pareles e4107e1257 add server? 2024-11-24 17:53:57 -08:00
Andrew Pareles 1d5fef43c1 improved error handling 2024-11-23 16:05:26 -08:00
Andrew Pareles 51280d4e77 error ui improvements 2024-11-22 00:43:07 -08:00
Andrew Pareles d5ccc6f777 minor changes 2024-11-21 22:37:31 -08:00
mp 4ea1bfa9c3 add structure for re-adding autocomplete 2024-11-21 19:05:54 -08:00
Andrew Pareles c58af2a3af Merge pull request #139 from voideditor/actual-editor-insets
Native Editor Insets
2024-11-21 18:32:25 -08:00
Andrew Pareles d857d54847 reference extension 2024-11-21 18:29:08 -08:00
Andrew Pareles a7cbed395b Merge branch 'autocomplete' into actual-editor-insets 2024-11-21 18:12:28 -08:00
Andrew Pareles f6479a0668 Merge remote-tracking branch 'origin/main' into actual-editor-insets 2024-11-21 17:56:19 -08:00
Andrew Pareles a50b5c6407 add minor debugging 2024-11-21 17:54:43 -08:00
mp 53d19d819c autocomplete UX 2024-11-21 05:58:43 -08:00
Piyush Bhardwaj a3e337fe2d Merge branch 'main' into Gemini 2024-11-21 17:51:24 +05:30
Andrew Pareles 1bb243bc34 comment fixes build 2024-11-21 03:57:17 -08:00
Andrew Pareles faaf3a738a rm console.logs 2024-11-21 03:56:46 -08:00
Andrew Pareles e8bbe4bf5a tsup works 2024-11-21 03:56:09 -08:00
Andrew Pareles 469bba178a Merge pull request #155 from jcommaret/actual-editor-insets
Build.js : Fixing tsup command
2024-11-21 03:51:32 -08:00
Jérôme Commaret 879595dbe6 Build.js : Fixing tsup command 2024-11-21 12:47:44 +01:00
Andrew Pareles f7d2e95d37 update contrib 2024-11-20 23:01:29 -08:00
Andrew Pareles 9dbc7f5caa + 2024-11-20 22:43:30 -08:00
Andrew Pareles 1cc35b1d79 fix contrib* 2024-11-20 22:42:03 -08:00
Andrew Pareles 2473f210bc update contrib 2024-11-20 22:39:16 -08:00
Andrew Pareles 604578bb19 update contrib 2024-11-20 22:32:58 -08:00
Andrew Pareles 1d73aad2ed revert FIM testing code 2024-11-20 22:29:18 -08:00
Andrew Pareles 8508c2dd8e Merge branch 'main' into actual-editor-insets 2024-11-20 21:59:34 -08:00
Andrew Pareles a8c5c696be remove extension build instructions 2024-11-20 21:43:14 -08:00
Andrew Pareles 077d460b29 huge revamp to get tabs working. tabs work! 2024-11-20 21:17:29 -08:00
Andrew Pareles f3d9893588 change from model.id to model.uri and fix listener leak 2024-11-20 03:14:16 -08:00
Andrew Pareles c004e1af03 add nice visuals for accept | delete and add comments for void 2024-11-20 00:40:59 -08:00
Andrew Pareles 0d227f2bd6 add void comment 2024-11-19 22:51:49 -08:00
Andrew Pareles 0b96901aee update error 2024-11-19 18:13:45 -08:00
Piyush Bhardwaj d12a5f3b38 Merge branch 'main' into Gemini 2024-11-19 18:10:58 +05:30
mp cd77542a9e Autocomplete (max number of pending requests, filter for matchup with user's text, better prompt) 2024-11-19 03:57:06 -08:00
Andrew Pareles 0c2660e283 add history to approve/reject 2024-11-19 02:22:41 -08:00
Andrew Pareles 9a591ba29f accept/reject works!! 2024-11-19 02:21:11 -08:00
Andrew Pareles 4c633ee8ff remove code 2024-11-18 21:02:18 -08:00
Andrew Pareles 67e9759d35 make history get added instantly so we can do interrupts 2024-11-18 18:05:50 -08:00
Andrew Pareles 93dac201b3 Merge pull request #150 from jcommaret/fix-extension-lodash-dep
lodash : package added to extension
2024-11-18 17:57:14 -08:00
Andrew Pareles 946ec70136 sweep works exceptionally! 2024-11-18 17:37:32 -08:00
mp 161682cf75 Merge remote-tracking branch 'origin/autocomplete' 2024-11-18 17:14:26 -08:00
mp 6df0093786 ui 2024-11-18 17:13:55 -08:00
Andrew Pareles a527af93b7 Merge pull request #145 from nathfavour/main
Main
2024-11-18 16:22:05 -08:00
Andrew Pareles 775cb2e4ac Update dev.nix 2024-11-18 16:21:47 -08:00
Piyush Bhardwaj 68b5187f7c Merge branch 'main' into Gemini 2024-11-18 20:13:41 +05:30
Jérôme Commaret aacbef3e33 lodash : package added to extension 2024-11-18 12:58:42 +01:00
Andrew Pareles f5b2dcfe0a use renderLines instead of custom styles (still doesnt compute line wrap properly though) 2024-11-18 01:09:02 -08:00
Andrew Pareles 9d25fab5cb fix linting 2024-11-17 21:40:46 -08:00
Andrew Pareles 250b90634f Merge pull request #142 from plon-Susk7/dev
pass build information to extension
2024-11-17 19:39:35 -08:00
Andrew Pareles e56716c792 move to posthog 2024-11-17 19:39:15 -08:00
Andrew Pareles 0bf5278168 Merge branch 'main' into pr/plon-Susk7/142 2024-11-17 19:35:07 -08:00
Andrew Pareles f2c61d2419 fix formatting 2024-11-17 19:32:06 -08:00
mp bdd224990d Merge branch 'autocomplete' 2024-11-17 16:49:09 -08:00
mp 0ca2ad4930 Create basic language server functionality 2024-11-17 16:48:23 -08:00
Andrew Pareles 5140c79dcf refactor to have openAI conventions 2024-11-17 02:19:21 -08:00
Andrew Pareles 91c65b6060 fix misc 2024-11-17 02:09:39 -08:00
Andrew Pareles afd40a59b5 Merge pull request #149 from dcqe/patch-1
fix windows command
2024-11-17 02:01:36 -08:00
Andrew Pareles e6177d44c6 fix overlapping green styles 2024-11-16 23:13:59 -08:00
Andrew Pareles 63778d2012 add new findDiff test 2024-11-16 23:05:52 -08:00
Andrew Pareles 7a33cde334 fix findDiffs 2024-11-16 22:59:45 -08:00
Andrew Pareles c4e29d1c3f add history back! 2024-11-16 22:30:59 -08:00
Andrew Pareles b6b5deaa58 diffArea stream highlighting works perfectly! 2024-11-16 21:58:56 -08:00
Andrew Pareles 689a583598 diff styling is pretty consistent 2024-11-16 21:55:09 -08:00
Andrew Pareles 9f6cacdbe1 + 2024-11-16 20:49:24 -08:00
Andrew Pareles abab461236 move around 2024-11-16 20:46:39 -08:00
Andrew Pareles 23579774b8 diffareas refresh on user changes 2024-11-16 20:35:46 -08:00
Nico Mayr 0ee85b0ffd fix windows command 2024-11-17 01:34:58 +01:00
Andrew Pareles c99b1a2132 diff works! 2024-11-15 23:30:31 -08:00
Andrew Pareles 8a9e9495f9 realign after write 2024-11-15 22:40:54 -08:00
Andrew Pareles 1437f592d2 BEFORE DELETE RESIZE 2024-11-15 22:34:37 -08:00
Andrew Pareles 4ac509f0c8 update originalCode to live in Diffs 2024-11-15 21:57:23 -08:00
Andrew Pareles f37440cd3f add colors 2024-11-15 20:30:09 -08:00
Andrew Pareles ea83546e42 temp remove addtohistory 2024-11-15 04:38:27 -08:00
Andrew Pareles e2b36d735c update VSReadFile 2024-11-15 04:31:01 -08:00
Andrew Pareles 1ca94080b8 modelService 2024-11-15 04:29:25 -08:00
Andrew Pareles 2ad063eb30 simplify sweep + refresh 2024-11-15 03:42:38 -08:00
Andrew Pareles 2aea2b81c2 restore diffareas properly 2024-11-14 23:42:53 -08:00
Andrew Pareles 3fc81f1baf actions 2024-11-14 22:30:58 -08:00
Andrew Pareles 063d9312c4 fix selection using .bind() 2024-11-14 22:11:41 -08:00
mp 04761c9418 Minor changes 2024-11-14 22:00:05 -08:00
Andrew Pareles 620b335dc5 update code selection code 2024-11-14 21:20:07 -08:00
mp a765d738e1 Basic LSP Usage 2024-11-14 18:08:52 -08:00
Andrew Pareles 878ec1e782 fixing bugs 2024-11-14 05:00:32 -08:00
Andrew Pareles 84d866205b remove bugs 2024-11-14 04:05:23 -08:00
Andrew Pareles a273780472 update services to not use a Provider 2024-11-14 03:38:41 -08:00
Andrew Pareles dbea46ba32 fix services in React 2024-11-14 03:22:37 -08:00
Andrew Pareles 50d21828c2 works!! 2024-11-14 02:17:02 -08:00
Andrew Pareles a974a5df69 works! 2024-11-14 02:09:55 -08:00
Andrew Pareles 799f6c2d16 fix build regex? 2024-11-14 01:58:40 -08:00
Andrew Pareles b8f3182ee3 .js only might work 2024-11-14 01:48:56 -08:00
Andrew Pareles f22bc26355 getting there... 2024-11-14 01:47:33 -08:00
Andrew Pareles 047cc03002 minor updates trying to get it to build 2024-11-14 01:29:54 -08:00
Andrew Pareles bd49aaffde update noExternal 2024-11-14 01:06:15 -08:00
Andrew Pareles 13f6fd5c66 build! 2024-11-14 00:53:06 -08:00
Andrew Pareles 1fe12d2bfd make everything revolve around model, not editor 2024-11-13 23:58:28 -08:00
Andrew Pareles 1cf371fa8b giant updates to registerInlineDiffs 2024-11-13 23:21:54 -08:00
Andrew Pareles ee72a2c3cd registerInlineDiffs progress 2024-11-13 03:25:18 -08:00
Andrew Pareles a5912ba538 progress adding diffs 2024-11-12 03:28:53 -08:00
mp 19a8d36e07 Add LRU cache 2024-11-12 02:31:26 -08:00
mp 339aff5d31 Refactor sendLLMMessage and add FIM mode 2024-11-12 01:36:32 -08:00
Andrew Pareles 4de3f1c7ef start editing registerInlineDiff 2024-11-12 00:40:33 -08:00
Andrew Pareles 6e2030d4d4 finish converting react to VS 2024-11-11 21:14:43 -08:00
nathfavour 665e5e1058 open in idx 2024-11-11 19:53:35 -08:00
Andrew Pareles 8b9a9c7e2b prefix 2024-11-11 03:39:18 -08:00
Andrew Pareles f8f60ef6b0 re-add tailwind for content:['./src2'] tag 2024-11-11 03:38:21 -08:00
Andrew Pareles d01a5fc44c delete tailwind.config 2024-11-11 03:33:16 -08:00
Andrew Pareles f713a624f9 add prefix in tailwind.config, apparently adding it in scope-tailwind doesnt work 2024-11-11 03:29:50 -08:00
Andrew Pareles c789ab2ab7 WORKS 2024-11-11 03:16:15 -08:00
Andrew Pareles 008a5812f3 build should work now 2024-11-11 03:10:17 -08:00
Andrew Pareles 06819e172a add scope 2024-11-11 03:04:48 -08:00
Andrew Pareles 1112f79cf5 update imports and tsup 2024-11-11 02:59:27 -08:00
Andrew Pareles 9a54a57cf4 move everything to src folder 2024-11-11 02:51:10 -08:00
Andrew Pareles c4d620c874 create scope-tailwind 2024-11-11 02:29:36 -08:00
Andrew Pareles 0cc06407ad start adding tailwind 2024-11-11 02:29:10 -08:00
mp aab065139e Trim prefixes to increase cache hit rate 2024-11-10 23:52:25 -08:00
pythons aa6b5c6b6c refactor: modularize LLM providers and types
- Split monolithic sendLLMMessage.ts into separate provider modules
- Create dedicated files for each LLM provider (anthropic, gemini, openai, ollama, greptile)
- Move types into separate types.ts file
- Update import paths across affected files
- No functional changes, purely architectural improvement

This refactoring improves code organization and maintainability by:
- Separating concerns for each LLM provider
- Making the codebase more modular
- Improving type management
2024-11-11 15:10:32 +08:00
Andrew Pareles 9fc3e413a9 services work in react 2024-11-10 19:39:22 -08:00
Andrew Pareles 289da6bd6d fixed linting 2024-11-10 17:14:16 -08:00
Andrew Pareles 1feb7ec485 try to fix linting (update package) 2024-11-10 16:55:19 -08:00
Andrew Pareles 5f97a4f8a6 del out/ 2024-11-10 16:27:19 -08:00
Andrew Pareles 752ebfff3b update externals 2024-11-10 16:26:01 -08:00
Andrew Pareles 01d99645a6 WORKS 2024-11-09 21:03:03 -08:00
Andrew Pareles 00814d51f1 misc updates 2024-11-09 20:23:28 -08:00
Andrew Pareles e8ff4d8328 revert 2024-11-09 20:11:20 -08:00
Andrew Pareles 8da76e72df big changes + react build pipeline (broken) 2024-11-09 19:57:57 -08:00
mp 652f64cd14 Add basic system prompt 2024-11-08 21:57:33 -08:00
Andrew Pareles b52f0d8dd7 misc 2024-11-08 17:29:40 -08:00
priyash7 f8917e7548 added strings to info 2024-11-08 17:51:56 +05:30
Andrew Pareles 932e9fe9c6 progress 2024-11-08 02:50:52 -08:00
Andrew Pareles 3fd4357503 progress migrating to native vscode 2024-11-08 02:23:11 -08:00
mp 9b878a9fc0 Merge remote-tracking branch 'origin/main' into autocomplete 2024-11-08 01:28:19 -08:00
mp 268d03fad5 Add working autocomplete with caching 2024-11-08 01:23:09 -08:00
Andrew Pareles 3aece81891 move void files around 2024-11-06 23:18:45 -08:00
Andrew Pareles 6b268a44bb backup again 2024-11-06 21:46:17 -08:00
Andrew Pareles 70ce23862b back up build 2024-11-06 20:50:09 -08:00
Andrew Pareles 1c32d3a1c9 update build 2024-11-06 19:45:02 -08:00
Andrew Pareles 2814c63765 drag and drop extension into main 2024-11-06 16:01:59 -08:00
Piyush Bhardwaj cc3a08e1ab Merge branch 'main' into Gemini 2024-11-06 22:11:38 +05:30
Piyu-Pika 5b3a6d240e minor bug fix 2024-11-06 22:04:46 +05:30
priyash7 cc8c4d33ef passed info 2024-11-06 17:25:35 +05:30
Andrew Pareles ada31ccf90 update build to work in general 2024-11-06 01:41:26 -08:00
Andrew Pareles 4a629be2e2 add build script hack 2024-11-05 23:41:55 -08:00
Piyu-Pika 8897feb290 Groq Added 2024-11-06 12:21:11 +05:30
Andrew Pareles 75f97ea9e1 update streaming state 2024-11-05 18:47:40 -08:00
Andrew Pareles 83b9547701 add compilation of openai so we can use it internally 2024-11-05 18:38:30 -08:00
Andrew Pareles 791f6b1151 Merge pull request #140 from Madhav160804/ollama-model-selection
Added Ollama Model Check for installed models
2024-11-04 14:44:29 -08:00
Madhav160804 1c739e521d ollama error handling 2024-11-05 02:49:24 +05:30
Madhav Dhingra 794f35fc37 added ollama model check 2024-11-05 02:30:30 +05:30
Andrew 6c93028ce3 misc 2024-11-03 19:39:57 -08:00
Andrew 49072d43ea minor changes 2024-11-03 18:06:40 -08:00
Andrew a5090b8025 simplify 2024-11-03 01:57:05 -08:00
Andrew 36c3cd53e1 add new logging algo and move applyDiffLazily to diffProvider 2024-11-03 00:31:32 -07:00
Andrew e4e1c7fb6c vscode types in extension 2024-11-02 21:53:08 -07:00
Andrew fcc8de807f Merge branch 'main' into actual-editor-insets 2024-11-02 21:26:14 -07:00
Andrew 9d972f72ea update and add imports of sendLLMMessage 2024-11-02 21:25:39 -07:00
Andrew 3d629396be backup of a working version 2024-11-02 20:42:08 -07:00
Mathew Pareles fe413cb474 Update install instructions 2024-11-02 18:38:33 -07:00
Andrew Pareles 277f99e080 Merge pull request #137 from eltociear/patch-2
docs: update .devcontainer/README.md
2024-11-02 02:51:05 -07:00
Andrew 584d026256 renders oldText nicely! 2024-11-02 00:50:18 -07:00
Andrew 5acc53311d add files to make native insets work! #124 2024-11-01 21:23:38 -07:00
Ikko Eltociear Ashimine b9ba3a36c4 docs: update .devcontainer/README.md
minor fix
2024-11-01 17:16:57 +09:00
mp d7c00addd5 update inline diffs 2024-10-31 17:10:39 -07:00
Andrew Pareles b34119c4df Merge pull request #134 from Piyu-Pika/Gemini
Gemini added #new feature
2024-10-30 23:19:52 -07:00
Andrew Pareles d098291c90 minor note 2024-10-30 23:19:34 -07:00
Andrew ed9e126a4a remove duplicate extension.ts 2024-10-30 23:16:36 -07:00
Andrew a8010eec15 simplify gemini 2024-10-30 22:46:47 -07:00
Piyu-Pika 8cd1ea305c Gemini 2024-10-31 10:41:04 +05:30
Piyush Bhardwaj 762264b030 Merge branch 'main' into Gemini 2024-10-31 10:28:17 +05:30
Andrew Pareles 48d5369196 amend 2024-10-30 19:09:43 -07:00
Andrew Pareles aab840db2d amend 2024-10-30 19:02:48 -07:00
Andrew Pareles 3526005e1c amend 2024-10-30 19:02:22 -07:00
Andrew Pareles 0ef8c66d54 simplify readme 2024-10-30 19:01:56 -07:00
Andrew cd9173c802 move ctrlk 2024-10-30 18:59:17 -07:00
Piyu-Pika 0c8a185df7 Gemini added 2024-10-29 18:05:07 +05:30
Andrew 0f0719c596 fix type 2024-10-29 00:26:46 -07:00
Andrew d9397d870f change CodeSelection type 2024-10-28 17:17:26 -07:00
Andrew 1704a7de7a improve line rounding 2024-10-28 16:34:19 -07:00
Andrew 616cd2e39b update back to enum 2024-10-28 15:58:48 -07:00
Andrew Pareles 222f90bbea Merge pull request #133 from voideditor/multiple-webviews
Max tokens is optional + other config updates - Fixes #128
2024-10-28 15:50:40 -07:00
Andrew ab5245d2d9 Max tokens is optional + other config updates - Fixes #128 2024-10-28 15:50:05 -07:00
Andrew Pareles a7a4488848 minor Contributing changes 2024-10-28 04:22:19 -07:00
Andrew Pareles 8e72c1392a Merge pull request #125 from voideditor/multiple-webviews
Speculative Edits
2024-10-28 03:59:53 -07:00
Andrew 70b6af34e1 Merge branch 'main' into multiple-webviews 2024-10-28 03:58:36 -07:00
Andrew 119462f663 fix imports?? 2024-10-28 03:58:09 -07:00
Andrew 8ee665cd57 fix imports 2024-10-28 03:53:40 -07:00
Andrew ace3f181ed Merge branch 'speculative-edits' into multiple-webviews 2024-10-28 03:53:02 -07:00
Andrew d3962acd30 merge - but appears broken 2024-10-28 03:44:13 -07:00
Andrew 18557c8f6e comment out ctrlk so it builds 2024-10-28 03:37:18 -07:00
Andrew 29b037726e Merge branch 'speculative-edits' into multiple-webviews 2024-10-28 03:36:39 -07:00
Andrew 59dc193f97 update contrib 2024-10-26 21:36:45 -07:00
Andrew Pareles bd778d259b fix typo 2024-10-26 21:33:12 -07:00
Andrew 605cf236a5 link issues 2024-10-26 19:17:53 -07:00
Andrew 8bc3a0d277 windows build works!! 2024-10-26 19:17:20 -07:00
Andrew d80c88bc38 move files to right places 2024-10-25 22:39:13 -07:00
Andrew dd34a5be57 fix ctrl L change 2024-10-25 22:35:13 -07:00
Andrew f4be80b724 Merge remote-tracking branch 'origin/ctrlk-diff-ui' into multiple-webviews 2024-10-25 22:31:44 -07:00
Andrew b40c58b78a Merge remote-tracking branch 'origin/speculative-edits' into multiple-webviews 2024-10-25 22:25:47 -07:00
Andrew 64468b6f4d Merge branch 'speculative-edits' into multiple-webviews 2024-10-25 22:14:11 -07:00
Andrew 8f83b063f1 add ctrlk webview provider 2024-10-25 22:10:22 -07:00
Andrew f56772a07a amend 2024-10-25 19:58:35 -07:00
Andrew 38662d2824 major refactor, allow 3 types of webview 2024-10-25 19:49:59 -07:00
Andrew a51873c06a move files to extension/ 2024-10-25 15:58:06 -07:00
Andrew a29543e4a7 Promisify 2024-10-25 01:33:54 -07:00
Andrew d4a2ac2796 draft 2024-10-25 01:22:10 -07:00
Andrew 4b5e09c124 Merge remote-tracking branch 'origin/speculative-edits' into ctrlk-diff-ui 2024-10-24 21:08:57 -07:00
Andrew f8f48fb98b + 2024-10-24 20:48:04 -07:00
229 changed files with 28533 additions and 17300 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ Next: **[Try it out!](#try-it)**
You may see improved VNC responsiveness when accessing a codespace from VS Code client since you can use a [VNC Viewer][def]. Here's how to do it.
1. Install [Visual Studio Code Stable](https://code.visualstudio.com/) or [Insiders](https://code.visualstudio.com/insiders/) and the the [GitHub Codespaces extension](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces).
1. Install [Visual Studio Code Stable](https://code.visualstudio.com/) or [Insiders](https://code.visualstudio.com/insiders/) and the [GitHub Codespaces extension](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces).
> **Note:** The GitHub Codespaces extension requires the Visual Studio Code distribution of Code - OSS.
+1
View File
@@ -11,6 +11,7 @@
**/extensions/markdown-language-features/notebook-out/**
**/extensions/markdown-math/notebook-out/**
**/extensions/notebook-renderers/renderer-out/index.js
**/extensions/open-remote-ssh/out/extension.js
**/extensions/simple-browser/media/index.js
**/extensions/typescript-language-features/test-workspace/**
**/extensions/typescript-language-features/extension.webpack.config.js
+1
View File
@@ -10,6 +10,7 @@
"jsdoc",
"header",
"local"
// "react" // Void
],
"rules": {
"constructor-super": "warn",
+3
View File
@@ -21,3 +21,6 @@ vscode.db
product.overrides.json
*.snap.actual
.vscode-test
.tmp/
.tmp2/
.tool-versions
+48
View File
@@ -0,0 +1,48 @@
# Created for Void
# To learn more about how to use Nix to configure your environment
# see: https://developers.google.com/idx/guides/customize-idx-env
{pkgs}: {
# Which nixpkgs channel to use.
channel = "stable-23.11"; # or "unstable"
# Use https://search.nixos.org/packages to find packages
packages = [
pkgs.nodejs_20
pkgs.yarn
pkgs.nodePackages.pnpm
pkgs.bun
pkgs.gh
];
# Sets environment variables in the workspace
env = {};
idx = {
# Search for the extensions you want on https://open-vsx.org/ and use "publisher.id"
extensions = [
# "vscodevim.vim"
];
workspace = {
# Runs when a workspace is first created with this `dev.nix` file
onCreate = {
npm-install = "npm ci --no-audit --prefer-offline --no-progress --timing";
# Open editors for the following files by default, if they exist:
default.openFiles = [
# Cover all the variations of language, src-dir, router (app/pages)
"pages/index.tsx" "pages/index.jsx"
"src/pages/index.tsx" "src/pages/index.jsx"
"app/page.tsx" "app/page.jsx"
"src/app/page.tsx" "src/app/page.jsx"
];
};
# To run something each time the workspace is (re)started, use the `onStart` hook
};
# Enable previews and customize configuration
previews = {
enable = true;
previews = {
web = {
command = ["npm" "run" "dev" "--" "--port" "$PORT" "--hostname" "0.0.0.0"];
manager = "web";
};
};
};
};
}
+30 -1
View File
@@ -29,6 +29,34 @@
}
}
},
{
"type": "npm",
"script": "watchreactd",
"label": "React - Build",
"isBackground": true,
"presentation": {
"reveal": "never",
"group": "buildWatchers",
"close": false
},
"problemMatcher": {
"owner": "typescript",
"applyTo": "closedDocuments",
"fileLocation": [
"absolute"
],
"pattern": {
"regexp": "Error: ([^(]+)\\((\\d+|\\d+,\\d+|\\d+,\\d+,\\d+,\\d+)\\): (.*)$",
"file": 1,
"location": 2,
"message": 3
},
"background": {
"beginsPattern": "Starting compilation",
"endsPattern": "Finished compilation"
}
}
},
{
"type": "npm",
"script": "watch-extensionsd",
@@ -61,7 +89,8 @@
"label": "VS Code - Build",
"dependsOn": [
"Core - Build",
"Ext - Build"
"Ext - Build",
"React - Build"
],
"group": {
"kind": "build",
+96 -90
View File
@@ -1,61 +1,77 @@
# Contributing to Void
### Welcome! 👋
This is the official guide on how to contribute to Void. We want to make it as easy as possible to contribute, so if you have any questions or comments, reach out via email or discord!
Welcome! 👋 This is a guide on how to contribute to Void. We want to make it as easy as possible to contribute, so if you have any questions or comments, reach out via email or discord!
There are a few ways to contribute:
There are two main ways to contribute:
- 💫 Complete items on the [Roadmap](https://github.com/orgs/voideditor/projects/2).
- 💡 Make suggestions in our [Discord](https://discord.gg/RSNjgaugJs).
- 🪴 Start new Issues - see [Issues](https://github.com/voideditor/void/issues).
- Suggest New Features ([discord](https://discord.gg/RSNjgaugJs))
- Build New Features ([project](https://github.com/orgs/voideditor/projects/2/views/3))
We use a [VSCode extension](https://code.visualstudio.com/api/get-started/your-first-extension) to implement most of Void's functionality. Scroll down to see 1. How to build/contribute to the Extension, or 2. How to build/contribute to the full IDE (for more native changes).
For some useful links we've compiled see [`VOID_USEFUL_LINKS.md`](https://github.com/voideditor/void/blob/main/VOID_USEFUL_LINKS.md).
### Codebase Guide
## 1. Building the Extension
We highly recommend reading [this](https://github.com/microsoft/vscode/wiki/Source-Code-Organization) article on VSCode's sourcecode organization.
Here's how you can start contributing to the Void extension. This is where you should get started if you're new.
<!-- ADD BLOG HERE
We wrote a [guide to working in VSCode].
-->
1. Clone the repository:
Most of Void's code lives in the folder `src/vs/workbench/contrib/void/`.
```
git clone https://github.com/voideditor/void
```
2. Open the folder `/extensions/void` in VSCode (open it in a new workspace, _don't_ just cd into it).
3. Install dependencies:
```
npm install
```
## Building Void
4. Compile the React by running `npm run build`. We created this build command to convert `sidebar/index.tsx` into `dist/`.
### a. Build Prerequisites - Mac
```
npm run build
```
If you're using a Mac, you need Python and XCode. You probably have these by default.
5. Run the project by pressing <kbd>F5</kbd>.
### b. Build Prerequisites - Windows
This will start a new instance of VSCode with the extension enabled. If this doesn't work, you can press <kbd>Ctrl+Shift+P</kbd>, select "Debug: Start Debugging", and select "VSCode Extension Development".
If you're using a Windows computer, first get [Visual Studio 2022](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community) (recommended) or [VS Build Tools](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools) (not recommended). If you already have both, you might need to run the next few steps on both of them.
## 2. Building the full IDE
Go to the "Workloads" tab and select:
- `Desktop development with C++`
- `Node.js build tools`
If you want to work on the full IDE, please follow the steps below. If you have any questions/issues, you can refer to VSCode's full [How to Contribute](https://github.com/microsoft/vscode/wiki/How-to-Contribute) page, which is where the steps below come from. Also feel free to submit an issue or get in touch with us with any build errors.
Go to the "Individual Components" tab and select:
- `MSVC v143 - VS 2022 C++ x64/x86 Spectre-mitigated libs (Latest)`
- `C++ ATL for latest build tools with Spectre Mitigations`
- `C++ MFC for latest build tools with Spectre Mitigations`
### a. Building on a Mac
Finally, click Install.
To build on a Mac, open `void/` in VSCode. Make sure you've built the extension by following the steps above (or just run `cd ./extensions/void && npm install && npm run build && npm run compile && cd ../..`). Also make sure you have Python and XCode installed on your system (you probably do by default).
### c. Build Prerequisites - Linux
1. Install all dependencies.
First, run `npm install -g node-gyp`. Then:
```
npm install
```
- Debian (Ubuntu, etc): `sudo apt-get install build-essential g++ libx11-dev libxkbfile-dev libsecret-1-dev libkrb5-dev python-is-python3`.
- Red Hat (Fedora, etc): `sudo dnf install @development-tools gcc gcc-c++ make libsecret-devel krb5-devel libX11-devel libxkbfile-devel`.
- Others: see [How to Contribute](https://github.com/microsoft/vscode/wiki/How-to-Contribute).
2. Run `npm run watch`.
### d. Building Void
This can take ~5 min. It's done when you see something like:
To build Void, open `void/` inside VSCode. Then open your terminal and run:
1. `npm install` to install all dependencies.
2. `npm run watchreact` to build Void's browser dependencies like React. (If this doesn't work, try `npm run buildreact`).
3. Build Void.
- Press <kbd>Cmd+Shift+B</kbd> (Mac).
- Press <kbd>Ctrl+Shift+B</kbd> (Windows/Linux).
- This step can take ~5 min. The build is done when you see two check marks.
4. Run Void.
- Run `./scripts/code.sh` (Mac/Linux).
- Run `./scripts/code.bat` (Windows).
6. Nice-to-knows.
- You can always press <kbd>Ctrl+R</kbd> (<kbd>Cmd+R</kbd>) inside the new window to reload and see your new changes. It's faster than <kbd>Ctrl+Shift+P</kbd> and `Reload Window`.
- You might want to add the flags `--user-data-dir ./.tmp/user-data --extensions-dir ./.tmp/extensions` to the above run command, which lets you delete the `.tmp` folder to reset any IDE changes you made when testing.
#### Building Void from Terminal
Alternatively, if you want to build Void from the terminal, instead of pressing <kbd>Cmd+Shift+B</kbd> you can run `npm run watch`. The build is done when you see something like this:
```
[watch-extensions] [00:37:39] Finished compilation extensions with 0 errors after 19303 ms
@@ -64,79 +80,67 @@ This can take ~5 min. It's done when you see something like:
[watch-client ] [00:38:07] Finished compilation with 0 errors after 5 ms
```
<!-- 3. Press <kbd>Ctrl+Shift+B</kbd> to start the build process. -->
3. In a new terminal, run `./scripts/code.sh`.
This should open up the built IDE after loading for some time. To see new changes without restarting the build, use <kbd>Ctrl+Shift+P</kbd> and run "Reload Window".
To bundle the IDE, run `npm run gulp vscode-darwin-arm64`. Here are the full options: `vscode-{win32-ia32 | win32-x64 | darwin-x64 | darwin-arm64 | linux-ia32 | linux-x64 | linux-arm}(-min)`
Now that you're set up, feel free to check out our [Issues](https://github.com/voideditor/void/issues) page!
**Common Fixes:**
- Make sure you have the same NodeJS version as `.nvmrc`.
- If you see `X [ERROR] Cannot start service: Host version "0.23.1" does not match binary version "0.23.0"`, run `npm i -D esbuild@0.23.0`
### b. Building on Windows
To build on Windows, please refer to [How to Contribute](https://github.com/microsoft/vscode/wiki/How-to-Contribute). We recommend building on Mac; we're Windows users who switch to Mac to build right now.
<!-- Get [Visual Studio 2022](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community). Also find the boxes for "Desktop development with C++" and "Node.js development" and get those, too.
If you get a node-gyp error in the next few steps, you should also get [Visual Studio Build Tools](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools), find the Visual Studio Build Tools box, click Install (or Modify), then in Individual Components:
check every item under `MSVC v143 - VS 2022 C++ x64/x86 Spectre-mitigated libs (Latest)`, `C++ ATL for latest build tools with Spectre Mitigations`, and `C++ MFC for latest build tools with Spectre Mitigations`.
#### Common Fixes
- Make sure you followed the prerequisite steps.
- Make sure you have Node version `20.16.0` (the version in `.nvmrc`)!
- If you get `"TypeError: Failed to fetch dynamically imported module"`, make sure all imports end with `.js`.
- If you see missing styles, wait a few seconds and then reload.
- If you have any questions, feel free to [submit an issue](https://github.com/voideditor/void/issues/new). You can also refer to VSCode's complete [How to Contribute](https://github.com/microsoft/vscode/wiki/How-to-Contribute) page.
## Packaging
We don't usually recommend packaging. Instead, you should probably just build. If you're sure you want to package Void into an executable app, make sure you've built first, then run one of the following commands. This will create a folder named `VSCode-darwin-arm64` or similar outside of the void/ repo (see below). Be patient - packaging can take ~25 minutes.
### Mac
- `npm run gulp vscode-darwin-arm64` - most common (Apple Silicon)
- `npm run gulp vscode-darwin-x64` (Intel)
### Windows
- `npm run gulp vscode-win32-x64` - most common
- `npm run gulp vscode-win32-ia32`
### Linux
- `npm run gulp vscode-linux-x64` - most common
- `npm run gulp vscode-linux-arm`
- `npm run gulp vscode-linux-ia32`
### Output
This will generate a folder outside of `void/`:
```bash
workspace/
├── void/ # Your Void fork
└── VSCode-darwin-arm64/ # Generated output
```
npm config set msvs_version 2022
```
-->
## Roadmap
### Distributing
Void's maintainers distribute Void on our website and in releases. If you'd like to see the scripts to convert `Mac .app -> .dmg`, `Windows folder -> .exe`, and `Linux folder -> appimage` for distribution, feel free to reach out.
Here are the most important topics on our Roadmap. More ⭐'s = more important.
## Pull Request Guidelines
These sometimes get outdated - please refer to our Issues page for the latest issues.
## ⭐⭐⭐ Make History work well.
- Please submit a pull request once you've made a change.
- No need to submit an Issue unless you're creating a new feature that might involve multiple PRs.
- Please don't use AI to write your PR 🙂
When the user submits a response or presses the apply/accept/reject button, we should add these events to the history, allowing the user to undo/redo them. Right now there is unexpected behavior if the user tries to undo or redo their changes.
## ⭐⭐⭐ Build Cursor-style quick edits (ctrl+k).
When the user presses ctrl+k, an input box should appear inline with the code that they were selecting. This is somewhat difficult to do because an extension alone cannot do this, and it requires creating a new component in the IDE. We think you can modify vscode's built-in "codelens" or "zone widget" components, but we are open to alternatives.
## ⭐⭐⭐ Creative.
Examples: creating better code search, or supporting AI agents that can edit across files and make multiple LLM calls.
Eventually, we want to build a convenient API for creating AI tools. The API will provide methods for creating the UI (showing an autocomplete suggestion, or creating a new diff), detecting event changes (like `onKeystroke` or `onFileOpen`), and modifying the user's file-system (storing indexes associated with each file), making it much easier to make your own AI plugin. We plan on building these features further along in timeline, but we wanted to list them for completeness.
## ⭐ One-stars.
⭐ Let the user accept / reject all Diffs in an entire file via the sidebar.
# Guidelines
Please don't make big refactors without speaking with us first. We'd like to keep the codebase similar to vscode so we can periodically rebase, and if we have big changes that gets complicated.
# Submitting a Pull Request
Please submit a pull request once you've made a change. Here are a few guidelines:
- A PR should be about one _single_ feature change. The fewer items you change, the more likely the PR is to be accepted.
- Your PR should contain a description that first explains at a high level what you did, and then describes the exact changes you made (and to which files). Please don't use vague statements like "refactored code" or "improved types" (instead, describe what code you refactored, or what types you changed).
- Try to avoid refactoring and making feature changes in the same PR.
<!--
# Relevant files
We keep track of all the files we've changed with Void so it's easy to rebase:
Edit: far too many changes to track... this is old
- README.md
- CONTRIBUTING.md
- VOID_USEFUL_LINKS.md
@@ -156,3 +160,5 @@ We keep track of all the files we've changed with Void so it's easy to rebase:
- build/npm/dirs.js
- vscode.proposed.editorInsets.d.ts - not modified, but code copied
-->
+26
View File
@@ -0,0 +1,26 @@
Void is a fork of VS Code, which is licensed under the MIT License (below).
Void's additions and modifications are licensed under the Apache 2.0 License (see LICENSE.txt).
--------------------
MIT License
Copyright (c) 2015 - present Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+197 -17
View File
@@ -1,21 +1,201 @@
MIT License
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Copyright (c) 2015 - present Microsoft Corporation
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
1. Definitions.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2025 Glass Devtools, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+26 -9
View File
@@ -1,22 +1,39 @@
# Welcome to Void.
<div align="center">
<img
src="./src/vs/workbench/browser/parts/editor/media/slice_of_void.png"
alt="Void Welcome"
width="300"
height="300"
/>
</div>
Void is the open-source Cursor alternative.
Void is the open-source Cursor alternative.
If you're new, welcome! Feel free to check out our [Project board](https://github.com/orgs/voideditor/projects/2/views/3) for the most pressing Issues to work on, and see [`CONTRIBUTING.md`](https://github.com/voideditor/void/blob/main/CONTRIBUTING.md) for instructions on building and running Void.
This repo contains the full sourcecode for Void. We are currently in [open beta](https://voideditor.com/email) for Discord members (see the `announcements` channel), with a waitlist for our official release. If you're new, welcome!
- 👋 [Discord](https://discord.gg/RSNjgaugJs)
- 🔨 [Contribute](https://github.com/voideditor/void/blob/main/CONTRIBUTING.md)
- 🚙 [Roadmap](https://github.com/orgs/voideditor/projects/2)
- 📝 [Changelog](https://voideditor.com/changelog)
This repo contains the full sourcecode for Void. We have a [waitlist](https://voideditor.com/email) for downloading the official release, but you can build and develop Void right now.
## Contributing
To build and run Void, see [`CONTRIBUTING.md`](https://github.com/voideditor/void/blob/main/CONTRIBUTING.md).
1. Feel free to attend a weekly meeting in our Discord channel if you'd like to contribute!
2. To get started working on Void, see [Contributing](https://github.com/voideditor/void/blob/main/CONTRIBUTING.md).
3. We're open to collaborations and suggestions of all types - just reach out.
## Reference
Void is a fork of the of [vscode](https://github.com/microsoft/vscode) repository.
For some useful links we've compiled see [`VOID_USEFUL_LINKS.md`](https://github.com/voideditor/void/blob/main/VOID_USEFUL_LINKS.md).
Void is a fork of the [vscode](https://github.com/microsoft/vscode) repository. For some useful links on VSCode, see [`VOID_USEFUL_LINKS.md`](https://github.com/voideditor/void/blob/main/VOID_USEFUL_LINKS.md).
## Support
Feel free to reach out in our [Discord](https://discord.gg/RSNjgaugJs) or contact us via email.
Feel free to reach out in our Discord or contact us via email: hello@voideditor.com.
-41
View File
@@ -1,41 +0,0 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.9 BLOCK -->
## Security
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet) and [Xamarin](https://github.com/xamarin).
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below.
## Reporting Security Issues
**Please do not report security vulnerabilities through public GitHub issues.**
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report).
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue
This information will help us triage your report more quickly.
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs.
## Preferred Languages
We prefer all communications to be in English.
## Policy
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd).
<!-- END MICROSOFT SECURITY.MD BLOCK -->
+10 -6
View File
@@ -2,23 +2,27 @@
The Void team put together this list of links to get up and running with VSCode's sourcecode. We hope it's helpful!
## Contributing
- [How VSCode's sourcecode is organized](https://github.com/microsoft/vscode/wiki/Source-Code-Organization) - this explains where the entry point files are, what `browser/` and `common/` mean, etc. This is the most important read on this whole list! We recommend reading the whole thing.
- [Built-in VSCode styles](https://code.visualstudio.com/api/references/theme-color) - CSS variables that are built into VSCode. Use `var(--vscode-{theme but replacing . with -})`. You can also see their [Webview theming guide](https://code.visualstudio.com/api/extension-guides/webview#theming-webview-content).
## Beginners / Getting started
- [VSCode UI guide](https://code.visualstudio.com/docs/getstarted/userinterface) - covers auxbar, panels, etc.
- [UX guide](https://code.visualstudio.com/api/ux-guidelines/overview) - covers Containers, Views, Items, etc.
## Contributing
- [How VS Code's sourcecode is organized](https://github.com/microsoft/vscode/wiki/Source-Code-Organization) - this explains where the entry point files are, what `browser/` and `common/` mean, etc. This is the most important read on this whole list! We recommend reading the whole thing.
## Misc
- [Every command](https://code.visualstudio.com/api/references/commands) built-in to VSCode - sometimes useful to reference.
- [Every command](https://code.visualstudio.com/api/references/commands) built-in to VSCode - not used often, but here for reference.
## VSCode's Extension API
Void is mainly an extension right now, and these links were very useful for us to get set up.
Void is no longer an extension, so these links are no longer required, but they might be useful if we ever build an extension again.
- [Files you need in an extension](https://code.visualstudio.com/api/get-started/extension-anatomy).
@@ -28,6 +32,6 @@ Void is mainly an extension right now, and these links were very useful for us t
- [The Full VSCode Extension API](https://code.visualstudio.com/api/references/vscode-api) - look on the right side for organization. The [bottom](https://code.visualstudio.com/api/references/vscode-api#api-patterns) of the page is easy to miss but is useful - cancellation tokens, events, disposables.
- [Activation events](https://code.visualstudio.com/api/references/activation-events) you can define in `package.json` (not the most useful)
- [Activation events](https://code.visualstudio.com/api/references/activation-events) you can define in `package.json` (not the most useful).
@@ -1,3 +1,5 @@
# Void - this looks like the relevant file for us (product-build-darwin.yml is independent and maybe just used for testing)
steps:
- task: NodeTool@0
inputs:
@@ -59,6 +61,8 @@ steps:
- script: node build/azure-pipelines/distro/mixin-quality
displayName: Mixin distro quality
## Void - IMPORTANT
- script: |
set -e
unzip $(Pipeline.Workspace)/unsigned_vscode_client_darwin_x64_archive/VSCode-darwin-x64.zip -d $(agent.builddirectory)/VSCode-darwin-x64
@@ -66,6 +70,7 @@ steps:
DEBUG=* node build/darwin/create-universal-app.js $(agent.builddirectory)
displayName: Create Universal App
## Void - IMPORTANT
- script: |
set -e
security create-keychain -p pwd $(agent.tempdirectory)/buildagent.keychain
+1
View File
@@ -4,6 +4,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
// Void explanation - product-build-darwin-universal.yml runs this (create-universal-app.ts), then sign.ts
const path = require("path");
const fs = require("fs");
const minimatch = require("minimatch");
+2
View File
@@ -3,6 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// Void explanation - product-build-darwin-universal.yml runs this (create-universal-app.ts), then sign.ts
import * as path from 'path';
import * as fs from 'fs';
import * as minimatch from 'minimatch';
+4 -4
View File
@@ -78,24 +78,24 @@ async function main(buildDir) {
// universal will get its copy from the x64 build.
if (arch !== 'universal') {
await (0, cross_spawn_promise_1.spawn)('plutil', [
'-insert',
'-replace', // Void changed this to replace
'NSAppleEventsUsageDescription',
'-string',
'An application in Visual Studio Code wants to use AppleScript.',
'An application in Void wants to use AppleScript.',
`${infoPlistPath}`
]);
await (0, cross_spawn_promise_1.spawn)('plutil', [
'-replace',
'NSMicrophoneUsageDescription',
'-string',
'An application in Visual Studio Code wants to use the Microphone.',
'An application in Void wants to use the Microphone.',
`${infoPlistPath}`
]);
await (0, cross_spawn_promise_1.spawn)('plutil', [
'-replace',
'NSCameraUsageDescription',
'-string',
'An application in Visual Studio Code wants to use the Camera.',
'An application in Void wants to use the Camera.',
`${infoPlistPath}`
]);
}
+4 -4
View File
@@ -89,24 +89,24 @@ async function main(buildDir?: string): Promise<void> {
// universal will get its copy from the x64 build.
if (arch !== 'universal') {
await spawn('plutil', [
'-insert',
'-replace', // Void changed this to replace
'NSAppleEventsUsageDescription',
'-string',
'An application in Visual Studio Code wants to use AppleScript.',
'An application in Void wants to use AppleScript.',
`${infoPlistPath}`
]);
await spawn('plutil', [
'-replace',
'NSMicrophoneUsageDescription',
'-string',
'An application in Visual Studio Code wants to use the Microphone.',
'An application in Void wants to use the Microphone.',
`${infoPlistPath}`
]);
await spawn('plutil', [
'-replace',
'NSCameraUsageDescription',
'-string',
'An application in Visual Studio Code wants to use the Camera.',
'An application in Void wants to use the Camera.',
`${infoPlistPath}`
]);
}
+1
View File
@@ -134,6 +134,7 @@ module.exports.indentationFilter = [
'!extensions/markdown-math/notebook-out/*.js',
'!extensions/ipynb/notebook-out/**',
'!extensions/notebook-renderers/renderer-out/*.js',
'!extensions/open-remote-ssh/out/*.js',
'!extensions/simple-browser/media/*.js',
];
+1
View File
@@ -55,6 +55,7 @@ const compilations = [
'extensions/microsoft-authentication/tsconfig.json',
'extensions/notebook-renderers/tsconfig.json',
'extensions/npm/tsconfig.json',
'extensions/open-remote-ssh/tsconfig.json',
'extensions/php-language-features/tsconfig.json',
'extensions/references-view/tsconfig.json',
'extensions/search-result/tsconfig.json',
+1 -1
View File
@@ -516,7 +516,7 @@ function tweakProductForServerWeb(product) {
['', 'min'].forEach(minified => {
const sourceFolderName = `out-vscode-${type}${dashed(minified)}`;
const destinationFolderName = `vscode-${type}${dashed(platform)}${dashed(arch)}`;
const destinationFolderName = `void-${type}${dashed(platform)}${dashed(arch)}`;
const serverTaskCI = task.define(`vscode-${type}${dashed(platform)}${dashed(arch)}${dashed(minified)}-ci`, task.series(
gulp.task(`node-${platform}-${arch}`),
+6 -4
View File
@@ -341,6 +341,8 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
this.emit('data', file);
}));
// Void - this is important, creates the product.json in .app
let productJsonContents;
const productJsonStream = gulp.src(['product.json'], { base: '.' })
.pipe(json({ commit, date: readISODate('out-build'), checksums, version }))
@@ -425,15 +427,15 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
'resources/win32/vue.ico',
'resources/win32/xml.ico',
'resources/win32/yaml.ico',
'resources/win32/code_70x70.png',
'resources/win32/code_150x150.png'
'resources/win32/code_70x70.png', // <-- Void icon
'resources/win32/code_150x150.png' // <-- Void icon
], { base: '.' }));
} else if (platform === 'linux') {
all = es.merge(all, gulp.src('resources/linux/code.png', { base: '.' }));
all = es.merge(all, gulp.src('resources/linux/code.png', { base: '.' })); // <-- Void icon
} else if (platform === 'darwin') {
const shortcut = gulp.src('resources/darwin/bin/code.sh')
.pipe(replace('@@APPNAME@@', product.applicationName))
.pipe(rename('bin/code'));
.pipe(rename('bin/code')); // <-- Void icon
all = es.merge(all, shortcut);
}
+2 -2
View File
@@ -54,7 +54,7 @@ function darwinBundleDocumentType(extensions, icon, nameOrSuffix, utis) {
role: 'Editor',
ostypes: ['TEXT', 'utxt', 'TUTX', '****'],
extensions,
iconFile: 'resources/darwin/' + icon.toLowerCase() + '.icns',
iconFile: 'resources/darwin/' + icon.toLowerCase() + '.icns', // <-- Void icon code.icns
utis
};
}
@@ -179,7 +179,7 @@ exports.config = {
darwinForceDarkModeSupport: true,
darwinCredits: darwinCreditsTemplate ? Buffer.from(darwinCreditsTemplate({ commit: commit, date: new Date().toISOString() })) : undefined,
linuxExecutableName: product.applicationName,
winIcon: 'resources/win32/code.ico',
winIcon: 'resources/win32/code.ico', // <-- Void icon
token: process.env['GITHUB_TOKEN'],
repo: product.electronRepository || undefined,
validateChecksum: true,
+2 -2
View File
@@ -68,7 +68,7 @@ function darwinBundleDocumentType(extensions: string[], icon: string, nameOrSuff
role: 'Editor',
ostypes: ['TEXT', 'utxt', 'TUTX', '****'],
extensions,
iconFile: 'resources/darwin/' + icon.toLowerCase() + '.icns',
iconFile: 'resources/darwin/' + icon.toLowerCase() + '.icns', // <-- Void icon code.icns
utis
};
}
@@ -196,7 +196,7 @@ export const config = {
darwinForceDarkModeSupport: true,
darwinCredits: darwinCreditsTemplate ? Buffer.from(darwinCreditsTemplate({ commit: commit, date: new Date().toISOString() })) : undefined,
linuxExecutableName: product.applicationName,
winIcon: 'resources/win32/code.ico',
winIcon: 'resources/win32/code.ico', // <-- Void icon
token: process.env['GITHUB_TOKEN'],
repo: product.electronRepository || undefined,
validateChecksum: true,
+6 -2
View File
@@ -7,8 +7,6 @@ const fs = require('fs');
// Complete list of directories where npm should be executed to install node modules
const dirs = [
'extensions/void', // <-- Void
'',
'build',
'extensions',
@@ -38,6 +36,7 @@ const dirs = [
'extensions/microsoft-authentication',
'extensions/notebook-renderers',
'extensions/npm',
'extensions/open-remote-ssh',
'extensions/php-language-features',
'extensions/references-view',
'extensions/search-result',
@@ -55,6 +54,11 @@ const dirs = [
'test/smoke',
'.vscode/extensions/vscode-selfhost-import-aid',
'.vscode/extensions/vscode-selfhost-test-provider',
// Void added these:
// 'extensions/void',
// 'void-imports',
];
if (fs.existsSync(`${__dirname}/../../.build/distro/npm`)) {
+18
View File
@@ -139,3 +139,21 @@ for (let dir of dirs) {
cp.execSync('git config pull.rebase merges');
cp.execSync('git config blame.ignoreRevsFile .git-blame-ignore-revs');
// // Void added this (inject void-imports into project):
// const buildVoidImports = () => {
// console.log('\n\nVoid is injecting void-imports...')
// cp.execSync(`npm install`, { // this goes here, not in postinstall, because we need to
// env: process.env,
// cwd: path.join(__dirname, '..', '..', '/void-imports'),
// stdio: 'inherit'
// });
// cp.execSync(`node build-index.mjs`, {
// env: process.env,
// cwd: path.join(__dirname, '..', '..', '/void-imports'),
// stdio: 'inherit'
// });
// console.log('Done injecting void-imports.')
// }
// buildVoidImports()
+5 -2
View File
@@ -4,6 +4,7 @@
? ('; LicenseFile: "' + RepoDir + '\licenses\LICENSE-' + Language + '.rtf"') \
: '; LicenseFile: "' + RepoDir + '\' + RootLicenseFileName + '"'
[Setup]
AppId={#AppId}
AppName={#NameLong}
@@ -20,8 +21,10 @@ Compression=lzma
SolidCompression=yes
AppMutex={code:GetAppMutex}
SetupMutex={#AppMutex}setup
WizardImageFile="{#RepoDir}\resources\win32\inno-big-100.bmp,{#RepoDir}\resources\win32\inno-big-125.bmp,{#RepoDir}\resources\win32\inno-big-150.bmp,{#RepoDir}\resources\win32\inno-big-175.bmp,{#RepoDir}\resources\win32\inno-big-200.bmp,{#RepoDir}\resources\win32\inno-big-225.bmp,{#RepoDir}\resources\win32\inno-big-250.bmp"
WizardSmallImageFile="{#RepoDir}\resources\win32\inno-small-100.bmp,{#RepoDir}\resources\win32\inno-small-125.bmp,{#RepoDir}\resources\win32\inno-small-150.bmp,{#RepoDir}\resources\win32\inno-small-175.bmp,{#RepoDir}\resources\win32\inno-small-200.bmp,{#RepoDir}\resources\win32\inno-small-225.bmp,{#RepoDir}\resources\win32\inno-small-250.bmp"
; this is a Void icon comment. Old: WizardImageFile="{#RepoDir}\resources\win32\inno-big-100.bmp,{#RepoDir}\resources\win32\inno-big-125.bmp,{#RepoDir}\resources\win32\inno-big-150.bmp,{#RepoDir}\resources\win32\inno-big-175.bmp,{#RepoDir}\resources\win32\inno-big-200.bmp,{#RepoDir}\resources\win32\inno-big-225.bmp,{#RepoDir}\resources\win32\inno-big-250.bmp"
; this is a Void icon comment. Old: WizardSmallImageFile="{#RepoDir}\resources\win32\inno-small-100.bmp,{#RepoDir}\resources\win32\inno-small-125.bmp,{#RepoDir}\resources\win32\inno-small-150.bmp,{#RepoDir}\resources\win32\inno-small-175.bmp,{#RepoDir}\resources\win32\inno-small-200.bmp,{#RepoDir}\resources\win32\inno-small-225.bmp,{#RepoDir}\resources\win32\inno-small-250.bmp"
; WizardImageFile="{#RepoDir}\resources\win32\inno-void.bmp"
WizardSmallImageFile="{#RepoDir}\resources\win32\inno-void.bmp"
SetupIconFile={#RepoDir}\resources\win32\code.ico
UninstallDisplayIcon={app}\{#ExeBasename}.exe
ChangesEnvironment=true
+112
View File
@@ -0,0 +1,112 @@
#!/bin/bash
set -e # Exit on error
set -x # Print commands as they are executed
# Configuration
APP_NAME="void"
APP_VERSION="1.0.0"
ARCH="x86_64"
export ARCH
# Check if void binary exists in current directory
if [ ! -f "./void" ]; then
echo "Error: void binary not found in current directory"
exit 1
fi
# Check if icon exists
if [ ! -f "./void.png" ]; then
echo "Error: void.png icon not found in current directory"
exit 1
fi
# Create temporary directory
TEMP_DIR="$(mktemp -d)"
echo "Created temporary directory: $TEMP_DIR"
APP_DIR="$TEMP_DIR/$APP_NAME.AppDir"
# Create basic AppDir structure
mkdir -pv "$APP_DIR/usr/bin"
mkdir -pv "$APP_DIR/usr/lib"
mkdir -pv "$APP_DIR/usr/share/applications"
mkdir -pv "$APP_DIR/usr/share/icons/hicolor/256x256/apps"
# Exclude create-appimage.sh and appimagetool-x86_64.AppImage from being copied
echo "Copying files excluding create-appimage.sh and appimagetool-x86_64.AppImage..."
for file in ./*; do
if [[ "$file" != "./create-appimage.sh" && "$file" != "./appimagetool-x86_64.AppImage" ]]; then
cp -rv "$file" "$APP_DIR/usr/bin/"
fi
done
# Copy the icon to required locations
cp -v ./void.png "$APP_DIR/void.png"
cp -v ./void.png "$APP_DIR/usr/share/icons/hicolor/256x256/apps/void.png"
# Copy dependencies with error checking
echo "Copying dependencies..."
for lib in $(ldd ./void | grep "=> /" | awk '{print $3}'); do
if [ -f "$lib" ]; then
cp -v "$lib" "$APP_DIR/usr/lib/" || echo "Failed to copy $lib"
else
echo "Warning: Library $lib not found"
fi
done
# Create desktop file with error checking
echo "Creating desktop file..."
if ! cat > "$APP_DIR/$APP_NAME.desktop" <<EOF
[Desktop Entry]
Name=$APP_NAME
Exec=void
Icon=void
Type=Application
Categories=Utility;
Comment=Void Linux Application
EOF
then
echo "Error creating desktop file"
exit 1
fi
# Make desktop file executable
chmod +x "$APP_DIR/$APP_NAME.desktop"
# Copy the desktop file to the applications directory
cp -v "$APP_DIR/$APP_NAME.desktop" "$APP_DIR/usr/share/applications/"
# Create AppRun with error checking
echo "Creating AppRun..."
if ! cat > "$APP_DIR/AppRun" <<EOF
#!/bin/bash
cd "\$(dirname "\$0")/usr/bin"
export LD_LIBRARY_PATH="\$APPDIR/usr/lib:\$LD_LIBRARY_PATH"
exec ./void "\$@"
EOF
then
echo "Error creating AppRun"
exit 1
fi
# Make AppRun executable
chmod +x "$APP_DIR/AppRun"
# Download appimagetool if not present in the current directory
if [ ! -f "./appimagetool-x86_64.AppImage" ]; then
echo "Downloading appimagetool-x86_64.AppImage..."
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
chmod +x appimagetool-x86_64.AppImage
else
echo "appimagetool-x86_64.AppImage is already present."
fi
# Create the AppImage
echo "Creating AppImage..."
ARCH=x86_64 ./appimagetool-x86_64.AppImage "$APP_DIR" "${APP_NAME}-${APP_VERSION}-${ARCH}.AppImage"
# Cleanup
echo "Cleaning up..."
rm -rf "$TEMP_DIR"
echo "AppImage creation complete!"
+74
View File
@@ -0,0 +1,74 @@
## 0.0.48
- Support `%n` in ProxyCommand
- fix: add missing direct @types/ssh2-stream dependency (#177)
- fix Win32 internal error (#178)
## 0.0.47
- Add support for loong64 (#175)
- Add s390x support (#174)
- Support vscodium alpine reh (#142)
## 0.0.46
- Add riscv64 support (#147)
## 0.0.45
- Use windows-x64 server on windows-arm64
## 0.0.44
- Update ssh2 lib
- Properly set extensionHost env variables
## 0.0.43
- Fix parsing multiple include directives
## 0.0.42
- Fix remote label to show port when connecting to a port other than 22
## 0.0.41
- Take into account parsed port from ssh destination. Fixes (#110)
## 0.0.40
- Update ssh-config package
## 0.0.39
- output error messages when downloading vscode server (#39)
- Add PreferredAuthentications support (#97)
## 0.0.38
- Enable remote support for ppc64le (#93)
## 0.0.37
- Default to Current OS User in Connection String if No User Provided (#91)
- Add support for (unofficial) DragonFly reh (#86)
## 0.0.36
- Make wget support continue download (#85)
## 0.0.35
- Fixes hardcoded agentsock for windows breaks pageant compatibility (#81)
## 0.0.34
- Add remote.SSH.connectTimeout setting
- adding %r username replacement to proxycommand (#77)
## 0.0.33
- feat: support %r user substitution in proxycommand
## 0.0.32
- feat: use serverDownloadUrlTemplate from product.json (#59)
## 0.0.31
- feat: support glob patterns in SSH include directives
## 0.0.30
- feat: support file patterns in SSH include directives
+48
View File
@@ -0,0 +1,48 @@
# Open Remote - SSH
## SSH Host Requirements
You can connect to a running SSH server on the following platforms.
**Supported**:
- x86_64 Debian 8+, Ubuntu 16.04+, CentOS / RHEL 7+ Linux.
- ARMv7l (AArch32) Raspbian Stretch/9+ (32-bit).
- ARMv8l (AArch64) Ubuntu 18.04+ (64-bit).
- macOS 10.14+ (Mojave)
- Windows 10+
- FreeBSD 13 (Requires manual remote-extension-host installation)
- DragonFlyBSD (Requires manual remote-extension-host installation)
## Requirements
**Activation**
Enable the extension in your `argv.json`
```json
{
...
"enable-proposed-api": [
...,
"jeanp413.open-remote-ssh",
]
...
}
```
which you can open by running the `Preferences: Configure Runtime Arguments` command.
The file is located in `~/.vscode-oss/argv.json`.
**Alpine linux**
When running on alpine linux, the packages `libstdc++` and `bash` are necessary and can be installed via
running
```bash
sudo apk add bash libstdc++
```
## SSH configuration file
[OpenSSH](https://www.openssh.com/) supports using a [configuration file](https://linuxize.com/post/using-the-ssh-config-file/) to store all your different SSH connections. To use an SSH config file, run the `Remote-SSH: Open SSH Configuration File...` command.
@@ -0,0 +1,17 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//@ts-check
'use strict';
const withBrowserDefaults = require('../shared.webpack.config').browser;
module.exports = withBrowserDefaults({
context: __dirname,
entry: {
extension: './src/extension.ts'
}
});
@@ -0,0 +1,34 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//@ts-check
'use strict';
const withDefaults = require('../shared.webpack.config');
const { IgnorePlugin } = require('webpack');
module.exports = withDefaults({
context: __dirname,
resolve: {
mainFields: ['module', 'main']
},
entry: {
extension: './src/extension.ts',
},
externals: {
vscode: "commonjs vscode",
bufferutil: "commonjs bufferutil",
"utf-8-validate": "commonjs utf-8-validate",
},
plugins: [
new IgnorePlugin({
resourceRegExp: /crypto\/build\/Release\/sshcrypto\.node$/,
}),
new IgnorePlugin({
resourceRegExp: /cpu-features/,
})
]
});
+370
View File
@@ -0,0 +1,370 @@
{
"name": "open-remote-ssh",
"version": "0.0.48",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "open-remote-ssh",
"version": "0.0.48",
"dependencies": {
"@jeanp413/ssh-config": "^4.3.1",
"glob": "^9.3.1",
"simple-socks": "git+https://github.com/jeanp413/simple-socks#main",
"socks": "^2.5.0",
"ssh2": "git+https://github.com/jeanp413/ssh2#master"
},
"devDependencies": {
"@types/ssh2": "^0.5.52",
"@types/ssh2-streams": "0.1.12"
},
"engines": {
"vscode": "^1.70.2"
}
},
"node_modules/@babel/runtime-corejs3": {
"version": "7.26.0",
"resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.26.0.tgz",
"integrity": "sha512-YXHu5lN8kJCb1LOb9PgV6pvak43X2h4HvRApcN5SdWeaItQOzfn1hgP6jasD6KWQyJDBxrVmA9o9OivlnNJK/w==",
"license": "MIT",
"dependencies": {
"core-js-pure": "^3.30.2",
"regenerator-runtime": "^0.14.0"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@jeanp413/ssh-config": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@jeanp413/ssh-config/-/ssh-config-4.3.1.tgz",
"integrity": "sha512-x0EaWRdjs5sPDNmYr11wVB1GdwWQgRekc7SbueuO5FK7YZUav98qZKtZZU5iSDKyxJkooCs3rgVizB1wIWrF7g==",
"license": "MIT"
},
"node_modules/@types/node": {
"version": "22.10.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.7.tgz",
"integrity": "sha512-V09KvXxFiutGp6B7XkpaDXlNadZxrzajcY50EuoLIpQ6WWYCSvf19lVIazzfIzQvhUN2HjX12spLojTnhuKlGg==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.20.0"
}
},
"node_modules/@types/ssh2": {
"version": "0.5.52",
"resolved": "https://registry.npmjs.org/@types/ssh2/-/ssh2-0.5.52.tgz",
"integrity": "sha512-lbLLlXxdCZOSJMCInKH2+9V/77ET2J6NPQHpFI0kda61Dd1KglJs+fPQBchizmzYSOJBgdTajhPqBO1xxLywvg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "*",
"@types/ssh2-streams": "*"
}
},
"node_modules/@types/ssh2-streams": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/@types/ssh2-streams/-/ssh2-streams-0.1.12.tgz",
"integrity": "sha512-Sy8tpEmCce4Tq0oSOYdfqaBpA3hDM8SoxoFh5vzFsu2oL+znzGz8oVWW7xb4K920yYMUY+PIG31qZnFMfPWNCg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/asn1": {
"version": "0.2.6",
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz",
"integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==",
"license": "MIT",
"dependencies": {
"safer-buffer": "~2.1.0"
}
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"license": "MIT"
},
"node_modules/bcrypt-pbkdf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
"integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==",
"license": "BSD-3-Clause",
"dependencies": {
"tweetnacl": "^0.14.3"
}
},
"node_modules/binary": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz",
"integrity": "sha512-D4H1y5KYwpJgK8wk1Cue5LLPgmwHKYSChkbspQg5JtVuR5ulGckxfR62H3AE9UDkdMC8yyXlqYihuz3Aqg2XZg==",
"license": "MIT",
"dependencies": {
"buffers": "~0.1.1",
"chainsaw": "~0.1.0"
},
"engines": {
"node": "*"
}
},
"node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/buffers": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz",
"integrity": "sha512-9q/rDEGSb/Qsvv2qvzIzdluL5k7AaJOTrw23z9reQthrbF7is4CtlT0DXyO1oei2DCp4uojjzQ7igaSHp1kAEQ==",
"engines": {
"node": ">=0.2.0"
}
},
"node_modules/buildcheck": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/buildcheck/-/buildcheck-0.0.6.tgz",
"integrity": "sha512-8f9ZJCUXyT1M35Jx7MkBgmBMo3oHTTBIPLiY9xyL0pl3T5RwcPEY8cUHr5LBNfu/fk6c2T4DJZuVM/8ZZT2D2A==",
"optional": true,
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/chainsaw": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz",
"integrity": "sha512-75kWfWt6MEKNC8xYXIdRpDehRYY/tNSgwKaJq+dbbDcxORuVrrQ+SEHoWsniVn9XPYfP4gmdWIeDk/4YNp1rNQ==",
"license": "MIT/X11",
"dependencies": {
"traverse": ">=0.3.0 <0.4"
},
"engines": {
"node": "*"
}
},
"node_modules/core-js-pure": {
"version": "3.40.0",
"resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.40.0.tgz",
"integrity": "sha512-AtDzVIgRrmRKQai62yuSIN5vNiQjcJakJb4fbhVw3ehxx7Lohphvw9SGNWKhLFqSxC4ilD0g/L1huAYFQU3Q6A==",
"hasInstallScript": true,
"license": "MIT",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/core-js"
}
},
"node_modules/cpu-features": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/cpu-features/-/cpu-features-0.0.10.tgz",
"integrity": "sha512-9IkYqtX3YHPCzoVg1Py+o9057a3i0fp7S530UWokCSaFVTc7CwXPRiOjRjBQQ18ZCNafx78YfnG+HALxtVmOGA==",
"hasInstallScript": true,
"optional": true,
"dependencies": {
"buildcheck": "~0.0.6",
"nan": "^2.19.0"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"license": "ISC"
},
"node_modules/glob": {
"version": "9.3.5",
"resolved": "https://registry.npmjs.org/glob/-/glob-9.3.5.tgz",
"integrity": "sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q==",
"license": "ISC",
"dependencies": {
"fs.realpath": "^1.0.0",
"minimatch": "^8.0.2",
"minipass": "^4.2.4",
"path-scurry": "^1.6.1"
},
"engines": {
"node": ">=16 || 14 >=14.17"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/ip-address": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz",
"integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==",
"license": "MIT",
"dependencies": {
"jsbn": "1.1.0",
"sprintf-js": "^1.1.3"
},
"engines": {
"node": ">= 12"
}
},
"node_modules/jsbn": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz",
"integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==",
"license": "MIT"
},
"node_modules/lru-cache": {
"version": "10.4.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
"integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
"license": "ISC"
},
"node_modules/minimatch": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.4.tgz",
"integrity": "sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA==",
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=16 || 14 >=14.17"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/minipass": {
"version": "4.2.8",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.8.tgz",
"integrity": "sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ==",
"license": "ISC",
"engines": {
"node": ">=8"
}
},
"node_modules/nan": {
"version": "2.22.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.22.0.tgz",
"integrity": "sha512-nbajikzWTMwsW+eSsNm3QwlOs7het9gGJU5dDZzRTQGk03vyBOauxgI4VakDzE0PtsGTmXPsXTbbjVhRwR5mpw==",
"license": "MIT",
"optional": true
},
"node_modules/path-scurry": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
"integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
"license": "BlueOak-1.0.0",
"dependencies": {
"lru-cache": "^10.2.0",
"minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
},
"engines": {
"node": ">=16 || 14 >=14.18"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/path-scurry/node_modules/minipass": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
"license": "ISC",
"engines": {
"node": ">=16 || 14 >=14.17"
}
},
"node_modules/regenerator-runtime": {
"version": "0.14.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==",
"license": "MIT"
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"license": "MIT"
},
"node_modules/simple-socks": {
"version": "2.2.2",
"resolved": "git+ssh://git@github.com/jeanp413/simple-socks.git#2ac739301a82d6baff04804ed494436a026acb60",
"license": "MIT",
"dependencies": {
"@babel/runtime-corejs3": "^7.16.8",
"binary": "^0.3.0"
}
},
"node_modules/smart-buffer": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
"license": "MIT",
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
}
},
"node_modules/socks": {
"version": "2.8.3",
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz",
"integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==",
"license": "MIT",
"dependencies": {
"ip-address": "^9.0.5",
"smart-buffer": "^4.2.0"
},
"engines": {
"node": ">= 10.0.0",
"npm": ">= 3.0.0"
}
},
"node_modules/sprintf-js": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
"integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==",
"license": "BSD-3-Clause"
},
"node_modules/ssh2": {
"version": "1.14.0",
"resolved": "git+ssh://git@github.com/jeanp413/ssh2.git#a169f627213aa663e0aa2fd2f0ef5c8931890c26",
"hasInstallScript": true,
"dependencies": {
"asn1": "^0.2.6",
"bcrypt-pbkdf": "^1.0.2"
},
"engines": {
"node": ">=10.16.0"
},
"optionalDependencies": {
"cpu-features": "~0.0.9",
"nan": "^2.17.0"
}
},
"node_modules/traverse": {
"version": "0.3.9",
"resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz",
"integrity": "sha512-iawgk0hLP3SxGKDfnDJf8wTz4p2qImnyihM5Hh/sGvQ3K37dPi/w8sRhdNIxYA1TwFwc5mDhIJq+O0RsvXBKdQ==",
"license": "MIT/X11",
"engines": {
"node": "*"
}
},
"node_modules/tweetnacl": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
"integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==",
"license": "Unlicense"
},
"node_modules/undici-types": {
"version": "6.20.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz",
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==",
"dev": true,
"license": "MIT"
}
}
}
+351
View File
@@ -0,0 +1,351 @@
{
"name": "open-remote-ssh",
"displayName": "Open Remote - SSH",
"publisher": "voideditor",
"description": "Use any remote machine with a SSH server as your development environment.",
"version": "0.0.48",
"icon": "resources/icon.png",
"engines": {
"vscode": "^1.70.2"
},
"extensionKind": [
"ui"
],
"enabledApiProposals": [
"resolvers",
"contribViewsRemote"
],
"keywords": [
"remote development",
"remote",
"ssh"
],
"api": "none",
"activationEvents": [
"onCommand:openremotessh.openEmptyWindow",
"onCommand:openremotessh.openEmptyWindowInCurrentWindow",
"onCommand:openremotessh.openConfigFile",
"onCommand:openremotessh.showLog",
"onResolveRemoteAuthority:ssh-remote",
"onView:sshHosts"
],
"main": "./out/extension.js",
"contributes": {
"configuration": {
"title": "Remote - SSH",
"properties": {
"remote.SSH.configFile": {
"type": "string",
"description": "The absolute file path to a custom SSH config file.",
"default": "",
"scope": "application"
},
"remote.SSH.connectTimeout": {
"type": "number",
"description": "Specifies the timeout in seconds used for the SSH command that connects to the remote.",
"default": 60,
"scope": "application",
"minimum": 1
},
"remote.SSH.defaultExtensions": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of extensions that should be installed automatically on all SSH hosts.",
"scope": "application"
},
"remote.SSH.enableDynamicForwarding": {
"type": "boolean",
"description": "Whether to use SSH dynamic forwarding to allow setting up new port tunnels over an existing SSH connection.",
"scope": "application",
"default": true
},
"remote.SSH.enableAgentForwarding": {
"type": "boolean",
"markdownDescription": "Enable fixing the remote environment so that the SSH config option `ForwardAgent` will take effect as expected from VS Code's remote extension host.",
"scope": "application",
"default": true
},
"remote.SSH.serverDownloadUrlTemplate": {
"type": "string",
"description": "The URL from where the vscode server will be downloaded. You can use the following variables and they will be replaced dynamically:\n- ${quality}: vscode server quality, e.g. stable or insiders\n- ${version}: vscode server version, e.g. 1.69.0\n- ${commit}: vscode server release commit\n- ${arch}: vscode server arch, e.g. x64, armhf, arm64\n- ${release}: release number",
"scope": "application",
"default": "https://github.com/voideditor/${NAME_OF_REPO}/releases/download/${version}.${release}/void-server-${os}-${arch}-${version}.${release}.tar.gz"
},
"remote.SSH.remotePlatform": {
"type": "object",
"description": "A map of the remote hostname to the platform for that remote. Valid values: linux, macos, windows.",
"scope": "application",
"default": {},
"additionalProperties": {
"type": "string",
"enum": [
"linux",
"macos",
"windows"
]
}
},
"remote.SSH.remoteServerListenOnSocket": {
"type": "boolean",
"description": "When true, the remote vscode server will listen on a socket path instead of opening a port. Only valid for Linux and macOS remotes. Requires `AllowStreamLocalForwarding` to be enabled for the SSH server.",
"default": false
},
"remote.SSH.experimental.serverBinaryName": {
"type": "string",
"description": "**Experimental:** The name of the server binary, use this **only if** you are using a client without a corresponding server release",
"scope": "application",
"default": ""
}
}
},
"views": {
"remote": [
{
"id": "sshHosts",
"name": "SSH Targets",
"group": "targets@1",
"remoteName": "ssh-remote"
}
]
},
"commands": [
{
"command": "openremotessh.openEmptyWindow",
"title": "Connect to Host...",
"category": "Remote-SSH"
},
{
"command": "openremotessh.openEmptyWindowInCurrentWindow",
"title": "Connect Current Window to Host...",
"category": "Remote-SSH"
},
{
"command": "openremotessh.openConfigFile",
"title": "Open SSH Configuration File...",
"category": "Remote-SSH"
},
{
"command": "openremotessh.showLog",
"title": "Show Log",
"category": "Remote-SSH"
},
{
"command": "openremotessh.explorer.emptyWindowInNewWindow",
"title": "Connect to Host in New Window",
"icon": "$(empty-window)"
},
{
"command": "openremotessh.explorer.emptyWindowInCurrentWindow",
"title": "Connect to Host in Current Window"
},
{
"command": "openremotessh.explorer.reopenFolderInCurrentWindow",
"title": "Open on SSH Host in Current Window"
},
{
"command": "openremotessh.explorer.reopenFolderInNewWindow",
"title": "Open on SSH Host in New Window",
"icon": "$(folder-opened)"
},
{
"command": "openremotessh.explorer.deleteFolderHistoryItem",
"title": "Remove From Recent List",
"icon": "$(x)"
},
{
"command": "openremotessh.explorer.refresh",
"title": "Refresh",
"icon": "$(refresh)"
},
{
"command": "openremotessh.explorer.configure",
"title": "Configure",
"icon": "$(gear)"
},
{
"command": "openremotessh.explorer.add",
"title": "Add New",
"icon": "$(plus)"
}
],
"resourceLabelFormatters": [
{
"scheme": "vscode-remote",
"authority": "ssh-remote+*",
"formatting": {
"label": "${path}",
"separator": "/",
"tildify": true,
"workspaceSuffix": "SSH"
}
}
],
"menus": {
"statusBar/remoteIndicator": [
{
"command": "openremotessh.openEmptyWindow",
"when": "remoteName =~ /^ssh-remote$/ && remoteConnectionState == connected",
"group": "remote_20_ssh_1general@1"
},
{
"command": "openremotessh.openEmptyWindowInCurrentWindow",
"when": "remoteName =~ /^ssh-remote$/ && remoteConnectionState == connected",
"group": "remote_20_ssh_1general@2"
},
{
"command": "openremotessh.openConfigFile",
"when": "remoteName =~ /^ssh-remote$/ && remoteConnectionState == connected",
"group": "remote_20_ssh_1general@3"
},
{
"command": "openremotessh.showLog",
"when": "remoteName =~ /^ssh-remote$/ && remoteConnectionState == connected",
"group": "remote_20_ssh_1general@4"
},
{
"command": "openremotessh.openEmptyWindow",
"when": "remoteConnectionState == disconnected",
"group": "remote_20_ssh_3local@1"
},
{
"command": "openremotessh.openEmptyWindowInCurrentWindow",
"when": "remoteConnectionState == disconnected",
"group": "remote_20_ssh_3local@2"
},
{
"command": "openremotessh.openConfigFile",
"when": "remoteConnectionState == disconnected",
"group": "remote_20_ssh_3local@3"
},
{
"command": "openremotessh.openEmptyWindow",
"when": "!remoteName && !virtualWorkspace",
"group": "remote_20_ssh_3local@5"
},
{
"command": "openremotessh.openEmptyWindowInCurrentWindow",
"when": "!remoteName && !virtualWorkspace",
"group": "remote_20_ssh_3local@6"
},
{
"command": "openremotessh.openConfigFile",
"when": "!remoteName && !virtualWorkspace",
"group": "remote_20_ssh_3local@7"
}
],
"commandPalette": [
{
"command": "openremotessh.explorer.refresh",
"when": "false"
},
{
"command": "openremotessh.explorer.configure",
"when": "false"
},
{
"command": "openremotessh.explorer.add",
"when": "false"
},
{
"command": "openremotessh.explorer.emptyWindowInNewWindow",
"when": "false"
},
{
"command": "openremotessh.explorer.emptyWindowInCurrentWindow",
"when": "false"
},
{
"command": "openremotessh.explorer.reopenFolderInCurrentWindow",
"when": "false"
},
{
"command": "openremotessh.explorer.reopenFolderInNewWindow",
"when": "false"
},
{
"command": "openremotessh.explorer.deleteFolderHistoryItem",
"when": "false"
}
],
"view/title": [
{
"command": "openremotessh.explorer.add",
"when": "view == sshHosts",
"group": "navigation"
},
{
"command": "openremotessh.explorer.configure",
"when": "view == sshHosts",
"group": "navigation"
},
{
"command": "openremotessh.explorer.refresh",
"when": "view == sshHosts",
"group": "navigation"
}
],
"view/item/context": [
{
"command": "openremotessh.explorer.emptyWindowInNewWindow",
"when": "viewItem =~ /^openremotessh.explorer.host$/",
"group": "inline@1"
},
{
"command": "openremotessh.explorer.emptyWindowInNewWindow",
"when": "viewItem =~ /^openremotessh.explorer.host$/",
"group": "navigation@2"
},
{
"command": "openremotessh.explorer.emptyWindowInCurrentWindow",
"when": "viewItem =~ /^openremotessh.explorer.host$/",
"group": "navigation@1"
},
{
"command": "openremotessh.explorer.reopenFolderInNewWindow",
"when": "viewItem == openremotessh.explorer.folder",
"group": "inline@1"
},
{
"command": "openremotessh.explorer.reopenFolderInNewWindow",
"when": "viewItem == openremotessh.explorer.folder",
"group": "navigation@2"
},
{
"command": "openremotessh.explorer.reopenFolderInCurrentWindow",
"when": "viewItem == openremotessh.explorer.folder",
"group": "navigation@1"
},
{
"command": "openremotessh.explorer.deleteFolderHistoryItem",
"when": "viewItem =~ /^openremotessh.explorer.folder/",
"group": "navigation@3"
},
{
"command": "openremotessh.explorer.deleteFolderHistoryItem",
"when": "viewItem =~ /^openremotessh.explorer.folder/",
"group": "inline@2"
}
]
}
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "gulp compile-extension:open-remote-ssh",
"compile-web": "npx webpack-cli --config extension-browser.webpack.config --mode none",
"watch": "gulp watch-extension:open-remote-ssh",
"watch-web": "npx webpack-cli --config extension-browser.webpack.config --mode none --watch --info-verbosity verbose"
},
"devDependencies": {
"@types/ssh2": "^0.5.52",
"@types/ssh2-streams": "0.1.12"
},
"dependencies": {
"glob": "^9.3.1",
"simple-socks": "git+https://github.com/jeanp413/simple-socks#main",
"socks": "^2.5.0",
"@jeanp413/ssh-config": "^4.3.1",
"ssh2": "git+https://github.com/jeanp413/ssh2#master"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

@@ -0,0 +1,464 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as cp from 'child_process';
import * as fs from 'fs';
import * as net from 'net';
import * as stream from 'stream';
import { SocksClient, SocksClientOptions } from 'socks';
import * as vscode from 'vscode';
import * as ssh2 from 'ssh2';
import type { ParsedKey } from 'ssh2-streams';
import Log from './common/logger';
import SSHDestination from './ssh/sshDestination';
import SSHConnection, { SSHTunnelConfig } from './ssh/sshConnection';
import SSHConfiguration from './ssh/sshConfig';
import { gatherIdentityFiles } from './ssh/identityFiles';
import { untildify, exists as fileExists } from './common/files';
import { findRandomPort } from './common/ports';
import { disposeAll } from './common/disposable';
import { installCodeServer, ServerInstallError } from './serverSetup';
import { isWindows } from './common/platform';
import * as os from 'os';
const PASSWORD_RETRY_COUNT = 3;
const PASSPHRASE_RETRY_COUNT = 3;
export const REMOTE_SSH_AUTHORITY = 'ssh-remote';
export function getRemoteAuthority(host: string) {
return `${REMOTE_SSH_AUTHORITY}+${host}`;
}
class TunnelInfo implements vscode.Disposable {
constructor(
readonly localPort: number,
readonly remotePortOrSocketPath: number | string,
private disposables: vscode.Disposable[]
) {
}
dispose() {
disposeAll(this.disposables);
}
}
interface SSHKey {
filename: string;
parsedKey: ParsedKey;
fingerprint: string;
agentSupport?: boolean;
isPrivate?: boolean;
}
export class RemoteSSHResolver implements vscode.RemoteAuthorityResolver, vscode.Disposable {
private proxyConnections: SSHConnection[] = [];
private sshConnection: SSHConnection | undefined;
private sshAgentSock: string | undefined;
private proxyCommandProcess: cp.ChildProcessWithoutNullStreams | undefined;
private socksTunnel: SSHTunnelConfig | undefined;
private tunnels: TunnelInfo[] = [];
private labelFormatterDisposable: vscode.Disposable | undefined;
constructor(
readonly context: vscode.ExtensionContext,
readonly logger: Log
) {
}
resolve(authority: string, context: vscode.RemoteAuthorityResolverContext): Thenable<vscode.ResolverResult> {
const [type, dest] = authority.split('+');
if (type !== REMOTE_SSH_AUTHORITY) {
throw new Error(`Invalid authority type for SSH resolver: ${type}`);
}
this.logger.info(`Resolving ssh remote authority '${authority}' (attemp #${context.resolveAttempt})`);
const sshDest = SSHDestination.parseEncoded(dest);
// It looks like default values are not loaded yet when resolving a remote,
// so let's hardcode the default values here
const remoteSSHconfig = vscode.workspace.getConfiguration('remote.SSH');
const enableDynamicForwarding = remoteSSHconfig.get<boolean>('enableDynamicForwarding', true)!;
const enableAgentForwarding = remoteSSHconfig.get<boolean>('enableAgentForwarding', true)!;
const serverDownloadUrlTemplate = remoteSSHconfig.get<string>('serverDownloadUrlTemplate');
const defaultExtensions = remoteSSHconfig.get<string[]>('defaultExtensions', []);
const remotePlatformMap = remoteSSHconfig.get<Record<string, string>>('remotePlatform', {});
const remoteServerListenOnSocket = remoteSSHconfig.get<boolean>('remoteServerListenOnSocket', false)!;
const connectTimeout = remoteSSHconfig.get<number>('connectTimeout', 60)!;
return vscode.window.withProgress({
title: `Setting up SSH Host ${sshDest.hostname}`,
location: vscode.ProgressLocation.Notification,
cancellable: false
}, async () => {
try {
const sshconfig = await SSHConfiguration.loadFromFS();
const sshHostConfig = sshconfig.getHostConfiguration(sshDest.hostname);
const sshHostName = sshHostConfig['HostName'] ? sshHostConfig['HostName'].replace('%h', sshDest.hostname) : sshDest.hostname;
const sshUser = sshHostConfig['User'] || sshDest.user || os.userInfo().username || ''; // https://github.com/openssh/openssh-portable/blob/5ec5504f1d328d5bfa64280cd617c3efec4f78f3/sshconnect.c#L1561-L1562
const sshPort = sshHostConfig['Port'] ? parseInt(sshHostConfig['Port'], 10) : (sshDest.port || 22);
this.sshAgentSock = sshHostConfig['IdentityAgent'] || process.env['SSH_AUTH_SOCK'] || (isWindows ? '\\\\.\\pipe\\openssh-ssh-agent' : undefined);
this.sshAgentSock = this.sshAgentSock ? untildify(this.sshAgentSock) : undefined;
const agentForward = enableAgentForwarding && (sshHostConfig['ForwardAgent'] || 'no').toLowerCase() === 'yes';
const agent = agentForward && this.sshAgentSock ? new ssh2.OpenSSHAgent(this.sshAgentSock) : undefined;
const preferredAuthentications = sshHostConfig['PreferredAuthentications'] ? sshHostConfig['PreferredAuthentications'].split(',').map(s => s.trim()) : ['publickey', 'password', 'keyboard-interactive'];
const identityFiles: string[] = (sshHostConfig['IdentityFile'] as unknown as string[]) || [];
const identitiesOnly = (sshHostConfig['IdentitiesOnly'] || 'no').toLowerCase() === 'yes';
const identityKeys = await gatherIdentityFiles(identityFiles, this.sshAgentSock, identitiesOnly, this.logger);
// Create proxy jump connections if any
let proxyStream: ssh2.ClientChannel | stream.Duplex | undefined;
if (sshHostConfig['ProxyJump']) {
const proxyJumps = sshHostConfig['ProxyJump'].split(',').filter(i => !!i.trim())
.map(i => {
const proxy = SSHDestination.parse(i);
const proxyHostConfig = sshconfig.getHostConfiguration(proxy.hostname);
return [proxy, proxyHostConfig] as [SSHDestination, Record<string, string>];
});
for (let i = 0; i < proxyJumps.length; i++) {
const [proxy, proxyHostConfig] = proxyJumps[i];
const proxyHostName = proxyHostConfig['HostName'] || proxy.hostname;
const proxyUser = proxyHostConfig['User'] || proxy.user || sshUser;
const proxyPort = proxyHostConfig['Port'] ? parseInt(proxyHostConfig['Port'], 10) : (proxy.port || sshPort);
const proxyAgentForward = enableAgentForwarding && (proxyHostConfig['ForwardAgent'] || 'no').toLowerCase() === 'yes';
const proxyAgent = proxyAgentForward && this.sshAgentSock ? new ssh2.OpenSSHAgent(this.sshAgentSock) : undefined;
const proxyIdentityFiles: string[] = (proxyHostConfig['IdentityFile'] as unknown as string[]) || [];
const proxyIdentitiesOnly = (proxyHostConfig['IdentitiesOnly'] || 'no').toLowerCase() === 'yes';
const proxyIdentityKeys = await gatherIdentityFiles(proxyIdentityFiles, this.sshAgentSock, proxyIdentitiesOnly, this.logger);
const proxyAuthHandler = this.getSSHAuthHandler(proxyUser, proxyHostName, proxyIdentityKeys, preferredAuthentications);
const proxyConnection = new SSHConnection({
host: !proxyStream ? proxyHostName : undefined,
port: !proxyStream ? proxyPort : undefined,
sock: proxyStream,
username: proxyUser,
readyTimeout: connectTimeout * 1000,
strictVendor: false,
agentForward: proxyAgentForward,
agent: proxyAgent,
authHandler: (arg0, arg1, arg2) => (proxyAuthHandler(arg0, arg1, arg2), undefined)
});
this.proxyConnections.push(proxyConnection);
const nextProxyJump = i < proxyJumps.length - 1 ? proxyJumps[i + 1] : undefined;
const destIP = nextProxyJump ? (nextProxyJump[1]['HostName'] || nextProxyJump[0].hostname) : sshHostName;
const destPort = nextProxyJump ? ((nextProxyJump[1]['Port'] && parseInt(nextProxyJump[1]['Port'], 10)) || nextProxyJump[0].port || 22) : sshPort;
proxyStream = await proxyConnection.forwardOut('127.0.0.1', 0, destIP, destPort);
}
} else if (sshHostConfig['ProxyCommand']) {
let proxyArgs = (sshHostConfig['ProxyCommand'] as unknown as string[])
.map((arg) => arg.replace('%h', sshHostName).replace('%n', sshDest.hostname).replace('%p', sshPort.toString()).replace('%r', sshUser));
let proxyCommand = proxyArgs.shift()!;
let options = {};
if (isWindows && /\.(bat|cmd)$/.test(proxyCommand)) {
proxyCommand = `"${proxyCommand}"`;
proxyArgs = proxyArgs.map((arg) => arg.includes(' ') ? `"${arg}"` : arg);
options = { shell: true, windowsHide: true, windowsVerbatimArguments: true };
}
this.logger.trace(`Spawning ProxyCommand: ${proxyCommand} ${proxyArgs.join(' ')}`);
const child = cp.spawn(proxyCommand, proxyArgs, options);
proxyStream = stream.Duplex.from({ readable: child.stdout, writable: child.stdin });
this.proxyCommandProcess = child;
}
// Create final shh connection
const sshAuthHandler = this.getSSHAuthHandler(sshUser, sshHostName, identityKeys, preferredAuthentications);
this.sshConnection = new SSHConnection({
host: !proxyStream ? sshHostName : undefined,
port: !proxyStream ? sshPort : undefined,
sock: proxyStream,
username: sshUser,
readyTimeout: connectTimeout * 1000,
strictVendor: false,
agentForward,
agent,
authHandler: (arg0, arg1, arg2) => (sshAuthHandler(arg0, arg1, arg2), undefined),
});
await this.sshConnection.connect();
const envVariables: Record<string, string | null> = {};
if (agentForward) {
envVariables['SSH_AUTH_SOCK'] = null;
}
const installResult = await installCodeServer(this.sshConnection, serverDownloadUrlTemplate, defaultExtensions, Object.keys(envVariables), remotePlatformMap[sshDest.hostname], remoteServerListenOnSocket, this.logger);
for (const key of Object.keys(envVariables)) {
if (installResult[key] !== undefined) {
envVariables[key] = installResult[key];
}
}
// Update terminal env variables
this.context.environmentVariableCollection.persistent = false;
for (const [key, value] of Object.entries(envVariables)) {
if (value) {
this.context.environmentVariableCollection.replace(key, value);
}
}
if (enableDynamicForwarding) {
const socksPort = await findRandomPort();
this.socksTunnel = await this.sshConnection!.addTunnel({
name: `ssh_tunnel_socks_${socksPort}`,
localPort: socksPort,
socks: true
});
}
const tunnelConfig = await this.openTunnel(0, installResult.listeningOn);
this.tunnels.push(tunnelConfig);
// Enable ports view
vscode.commands.executeCommand('setContext', 'forwardedPortsViewEnabled', true);
this.labelFormatterDisposable?.dispose();
this.labelFormatterDisposable = vscode.workspace.registerResourceLabelFormatter({
scheme: 'vscode-remote',
authority: `${REMOTE_SSH_AUTHORITY}+*`,
formatting: {
label: '${path}',
separator: '/',
tildify: true,
workspaceSuffix: `SSH: ${sshDest.hostname}` + (sshDest.port && sshDest.port !== 22 ? `:${sshDest.port}` : '')
}
});
const resolvedResult: vscode.ResolverResult = new vscode.ResolvedAuthority('127.0.0.1', tunnelConfig.localPort, installResult.connectionToken);
resolvedResult.extensionHostEnv = envVariables;
return resolvedResult;
} catch (e: unknown) {
this.logger.error(`Error resolving authority`, e);
// Initial connection
if (context.resolveAttempt === 1) {
this.logger.show();
const closeRemote = 'Close Remote';
const retry = 'Retry';
const result = await vscode.window.showErrorMessage(`Could not establish connection to "${sshDest.hostname}"`, { modal: true }, closeRemote, retry);
if (result === closeRemote) {
await vscode.commands.executeCommand('workbench.action.remote.close');
} else if (result === retry) {
await vscode.commands.executeCommand('workbench.action.reloadWindow');
}
}
if (e instanceof ServerInstallError || !(e instanceof Error)) {
throw vscode.RemoteAuthorityResolverError.NotAvailable(e instanceof Error ? e.message : String(e));
} else {
throw vscode.RemoteAuthorityResolverError.TemporarilyNotAvailable(e.message);
}
}
});
}
private async openTunnel(localPort: number, remotePortOrSocketPath: number | string) {
localPort = localPort > 0 ? localPort : await findRandomPort();
const disposables: vscode.Disposable[] = [];
const remotePort = typeof remotePortOrSocketPath === 'number' ? remotePortOrSocketPath : undefined;
const remoteSocketPath = typeof remotePortOrSocketPath === 'string' ? remotePortOrSocketPath : undefined;
if (this.socksTunnel && remotePort) {
const forwardingServer = await new Promise<net.Server>((resolve, reject) => {
this.logger.trace(`Creating forwarding server ${localPort}(local) => ${this.socksTunnel!.localPort!}(socks) => ${remotePort}(remote)`);
const socksOptions: SocksClientOptions = {
proxy: {
host: '127.0.0.1',
port: this.socksTunnel!.localPort!,
type: 5
},
command: 'connect',
destination: {
host: '127.0.0.1',
port: remotePort
}
};
const server: net.Server = net.createServer()
.on('error', reject)
.on('connection', async (socket: net.Socket) => {
try {
const socksConn = await SocksClient.createConnection(socksOptions);
socket.pipe(socksConn.socket);
socksConn.socket.pipe(socket);
} catch (error) {
this.logger.error(`Error while creating SOCKS connection`, error);
}
})
.on('listening', () => resolve(server))
.listen(localPort);
});
disposables.push({
dispose: () => forwardingServer.close(() => {
this.logger.trace(`SOCKS forwading server closed`);
}),
});
} else {
this.logger.trace(`Opening tunnel ${localPort}(local) => ${remotePortOrSocketPath}(remote)`);
const tunnelConfig = await this.sshConnection!.addTunnel({
name: `ssh_tunnel_${localPort}_${remotePortOrSocketPath}`,
remoteAddr: '127.0.0.1',
remotePort,
remoteSocketPath,
localPort
});
disposables.push({
dispose: () => {
this.sshConnection?.closeTunnel(tunnelConfig.name);
this.logger.trace(`Tunnel ${tunnelConfig.name} closed`);
}
});
}
return new TunnelInfo(localPort, remotePortOrSocketPath, disposables);
}
private getSSHAuthHandler(sshUser: string, sshHostName: string, identityKeys: SSHKey[], preferredAuthentications: string[]) {
let passwordRetryCount = PASSWORD_RETRY_COUNT;
let keyboardRetryCount = PASSWORD_RETRY_COUNT;
identityKeys = identityKeys.slice();
return async (methodsLeft: string[] | null, _partialSuccess: boolean | null, callback: (nextAuth: ssh2.AuthHandlerResult) => void) => {
if (methodsLeft === null) {
this.logger.info(`Trying no-auth authentication`);
return callback({
type: 'none',
username: sshUser,
});
}
if (methodsLeft.includes('publickey') && identityKeys.length && preferredAuthentications.includes('publickey')) {
const identityKey = identityKeys.shift()!;
this.logger.info(`Trying publickey authentication: ${identityKey.filename} ${identityKey.parsedKey.type} SHA256:${identityKey.fingerprint}`);
if (identityKey.agentSupport) {
return callback({
type: 'agent',
username: sshUser,
agent: new class extends ssh2.OpenSSHAgent {
// Only return the current key
override getIdentities(callback: (err: Error | undefined, publicKeys?: ParsedKey[]) => void): void {
callback(undefined, [identityKey.parsedKey]);
}
}(this.sshAgentSock!)
});
}
if (identityKey.isPrivate) {
return callback({
type: 'publickey',
username: sshUser,
key: identityKey.parsedKey
});
}
if (!await fileExists(identityKey.filename)) {
// Try next identity file
return callback(null as any);
}
const keyBuffer = await fs.promises.readFile(identityKey.filename);
let result = ssh2.utils.parseKey(keyBuffer); // First try without passphrase
if (result instanceof Error && result.message === 'Encrypted private OpenSSH key detected, but no passphrase given') {
let passphraseRetryCount = PASSPHRASE_RETRY_COUNT;
while (result instanceof Error && passphraseRetryCount > 0) {
const passphrase = await vscode.window.showInputBox({
title: `Enter passphrase for ${identityKey.filename}`,
password: true,
ignoreFocusOut: true
});
if (!passphrase) {
break;
}
result = ssh2.utils.parseKey(keyBuffer, passphrase);
passphraseRetryCount--;
}
}
if (!result || result instanceof Error) {
// Try next identity file
return callback(null as any);
}
const key = Array.isArray(result) ? result[0] : result;
return callback({
type: 'publickey',
username: sshUser,
key
});
}
if (methodsLeft.includes('password') && passwordRetryCount > 0 && preferredAuthentications.includes('password')) {
if (passwordRetryCount === PASSWORD_RETRY_COUNT) {
this.logger.info(`Trying password authentication`);
}
const password = await vscode.window.showInputBox({
title: `Enter password for ${sshUser}@${sshHostName}`,
password: true,
ignoreFocusOut: true
});
passwordRetryCount--;
return callback(password
? {
type: 'password',
username: sshUser,
password
}
: false);
}
if (methodsLeft.includes('keyboard-interactive') && keyboardRetryCount > 0 && preferredAuthentications.includes('keyboard-interactive')) {
if (keyboardRetryCount === PASSWORD_RETRY_COUNT) {
this.logger.info(`Trying keyboard-interactive authentication`);
}
return callback({
type: 'keyboard-interactive',
username: sshUser,
prompt: async (_name, _instructions, _instructionsLang, prompts, finish) => {
const responses: string[] = [];
for (const prompt of prompts) {
const response = await vscode.window.showInputBox({
title: `(${sshUser}@${sshHostName}) ${prompt.prompt}`,
password: !prompt.echo,
ignoreFocusOut: true
});
if (response === undefined) {
keyboardRetryCount = 0;
break;
}
responses.push(response);
}
keyboardRetryCount--;
finish(responses);
}
});
}
callback(false);
};
}
dispose() {
disposeAll(this.tunnels);
// If there's proxy connections then just close the parent connection
if (this.proxyConnections.length) {
this.proxyConnections[0].close();
} else {
this.sshConnection?.close();
}
this.proxyCommandProcess?.kill();
this.labelFormatterDisposable?.dispose();
}
}
@@ -0,0 +1,68 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import * as fs from 'fs';
import { getRemoteAuthority } from './authResolver';
import { getSSHConfigPath } from './ssh/sshConfig';
import { exists as fileExists } from './common/files';
import SSHDestination from './ssh/sshDestination';
export async function promptOpenRemoteSSHWindow(reuseWindow: boolean) {
const host = await vscode.window.showInputBox({
title: 'Enter [user@]hostname[:port]'
});
if (!host) {
return;
}
const sshDest = new SSHDestination(host);
openRemoteSSHWindow(sshDest.toEncodedString(), reuseWindow);
}
export function openRemoteSSHWindow(host: string, reuseWindow: boolean) {
vscode.commands.executeCommand('vscode.newWindow', { remoteAuthority: getRemoteAuthority(host), reuseWindow });
}
export function openRemoteSSHLocationWindow(host: string, path: string, reuseWindow: boolean) {
vscode.commands.executeCommand('vscode.openFolder', vscode.Uri.from({ scheme: 'vscode-remote', authority: getRemoteAuthority(host), path }), { forceNewWindow: !reuseWindow });
}
export async function addNewHost() {
const sshConfigPath = getSSHConfigPath();
if (!await fileExists(sshConfigPath)) {
await fs.promises.appendFile(sshConfigPath, '');
}
await vscode.commands.executeCommand('vscode.open', vscode.Uri.file(sshConfigPath), { preview: false });
const textEditor = vscode.window.activeTextEditor;
if (textEditor?.document.uri.fsPath !== sshConfigPath) {
return;
}
const textDocument = textEditor.document;
const lastLine = textDocument.lineAt(textDocument.lineCount - 1);
if (!lastLine.isEmptyOrWhitespace) {
await textEditor.edit((editBuilder: vscode.TextEditorEdit) => {
editBuilder.insert(lastLine.range.end, '\n');
});
}
const snippet = '\nHost ${1:dev}\n\tHostName ${2:dev.example.com}\n\tUser ${3:john}';
await textEditor.insertSnippet(
new vscode.SnippetString(snippet),
new vscode.Position(textDocument.lineCount, 0)
);
}
export async function openSSHConfigFile() {
const sshConfigPath = getSSHConfigPath();
if (!await fileExists(sshConfigPath)) {
await fs.promises.appendFile(sshConfigPath, '');
}
vscode.commands.executeCommand('vscode.open', vscode.Uri.file(sshConfigPath));
}
@@ -0,0 +1,41 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
export function disposeAll(disposables: vscode.Disposable[]): void {
while (disposables.length) {
const item = disposables.pop();
if (item) {
item.dispose();
}
}
}
export abstract class Disposable {
private _isDisposed = false;
protected _disposables: vscode.Disposable[] = [];
public dispose(): any {
if (this._isDisposed) {
return;
}
this._isDisposed = true;
disposeAll(this._disposables);
}
protected _register<T extends vscode.Disposable>(value: T): T {
if (this._isDisposed) {
value.dispose();
} else {
this._disposables.push(value);
}
return value;
}
protected get isDisposed(): boolean {
return this._isDisposed;
}
}
@@ -0,0 +1,25 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as fs from 'fs';
import * as os from 'os';
const homeDir = os.homedir();
export async function exists(path: string) {
try {
await fs.promises.access(path);
return true;
} catch {
return false;
}
}
export function untildify(path: string) {
return path.replace(/^~(?=$|\/|\\)/, homeDir);
}
export function normalizeToSlash(path: string) {
return path.replace(/\\/g, '/');
}
@@ -0,0 +1,63 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
type LogLevel = 'Trace' | 'Info' | 'Error';
export default class Log {
private output: vscode.OutputChannel;
constructor(name: string) {
this.output = vscode.window.createOutputChannel(name);
}
private data2String(data: any): string {
if (data instanceof Error) {
return data.stack || data.message;
}
if (data.success === false && data.message) {
return data.message;
}
return data.toString();
}
public trace(message: string, data?: any): void {
this.logLevel('Trace', message, data);
}
public info(message: string, data?: any): void {
this.logLevel('Info', message, data);
}
public error(message: string, data?: any): void {
this.logLevel('Error', message, data);
}
public logLevel(level: LogLevel, message: string, data?: any): void {
this.output.appendLine(`[${level} - ${this.now()}] ${message}`);
if (data) {
this.output.appendLine(this.data2String(data));
}
}
private now(): string {
const now = new Date();
return padLeft(now.getUTCHours() + '', 2, '0')
+ ':' + padLeft(now.getMinutes() + '', 2, '0')
+ ':' + padLeft(now.getUTCSeconds() + '', 2, '0') + '.' + now.getMilliseconds();
}
public show() {
this.output.show();
}
public dispose() {
this.output.dispose();
}
}
function padLeft(s: string, n: number, pad = ' ') {
return pad.repeat(Math.max(0, n - s.length)) + s;
}
@@ -0,0 +1,7 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export const isWindows = process.platform === 'win32';
export const isMacintosh = process.platform === 'darwin';
export const isLinux = process.platform === 'linux';
@@ -0,0 +1,133 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as net from 'net';
/**
* Finds a random unused port assigned by the operating system. Will reject in case no free port can be found.
*/
export function findRandomPort(): Promise<number> {
return new Promise((resolve, reject) => {
const server = net.createServer({ pauseOnConnect: true });
server.on('error', reject);
server.on('listening', () => {
const port = (server.address() as net.AddressInfo).port;
server.close(() => resolve(port));
});
server.listen(0, '127.0.0.1');
});
}
/**
* Given a start point and a max number of retries, will find a port that
* is openable. Will return 0 in case no free port can be found.
*/
export function findFreePort(startPort: number, giveUpAfter: number, timeout: number, stride = 1): Promise<number> {
let done = false;
return new Promise(resolve => {
const timeoutHandle = setTimeout(() => {
if (!done) {
done = true;
return resolve(0);
}
}, timeout);
doFindFreePort(startPort, giveUpAfter, stride, (port) => {
if (!done) {
done = true;
clearTimeout(timeoutHandle);
return resolve(port);
}
});
});
}
function doFindFreePort(startPort: number, giveUpAfter: number, stride: number, clb: (port: number) => void): void {
if (giveUpAfter === 0) {
return clb(0);
}
const client = new net.Socket();
// If we can connect to the port it means the port is already taken so we continue searching
client.once('connect', () => {
dispose(client);
return doFindFreePort(startPort + stride, giveUpAfter - 1, stride, clb);
});
client.once('data', () => {
// this listener is required since node.js 8.x
});
client.once('error', (err: Error & { code?: string }) => {
dispose(client);
// If we receive any non ECONNREFUSED error, it means the port is used but we cannot connect
if (err.code !== 'ECONNREFUSED') {
return doFindFreePort(startPort + stride, giveUpAfter - 1, stride, clb);
}
// Otherwise it means the port is free to use!
return clb(startPort);
});
client.connect(startPort, '127.0.0.1');
}
/**
* Uses listen instead of connect. Is faster, but if there is another listener on 0.0.0.0 then this will take 127.0.0.1 from that listener.
*/
export function findFreePortFaster(startPort: number, giveUpAfter: number, timeout: number): Promise<number> {
let resolved = false;
let timeoutHandle: NodeJS.Timeout | undefined = undefined;
let countTried = 1;
const server = net.createServer({ pauseOnConnect: true });
function doResolve(port: number, resolve: (port: number) => void) {
if (!resolved) {
resolved = true;
server.removeAllListeners();
server.close();
if (timeoutHandle) {
clearTimeout(timeoutHandle);
}
resolve(port);
}
}
return new Promise<number>(resolve => {
timeoutHandle = setTimeout(() => {
doResolve(0, resolve);
}, timeout);
server.on('listening', () => {
doResolve(startPort, resolve);
});
server.on('error', err => {
if (err && ((<any>err).code === 'EADDRINUSE' || (<any>err).code === 'EACCES') && (countTried < giveUpAfter)) {
startPort++;
countTried++;
server.listen(startPort, '127.0.0.1');
} else {
doResolve(0, resolve);
}
});
server.on('close', () => {
doResolve(0, resolve);
});
server.listen(startPort, '127.0.0.1');
});
}
function dispose(socket: net.Socket): void {
try {
socket.removeAllListeners('connect');
socket.removeAllListeners('error');
socket.end();
socket.destroy();
socket.unref();
} catch (error) {
console.error(error); // otherwise this error would get lost in the callback chain
}
}
@@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import Log from './common/logger';
import { RemoteSSHResolver, REMOTE_SSH_AUTHORITY } from './authResolver';
import { openSSHConfigFile, promptOpenRemoteSSHWindow } from './commands';
import { HostTreeDataProvider } from './hostTreeView';
import { getRemoteWorkspaceLocationData, RemoteLocationHistory } from './remoteLocationHistory';
export async function activate(context: vscode.ExtensionContext) {
const logger = new Log('Remote - SSH');
context.subscriptions.push(logger);
const remoteSSHResolver = new RemoteSSHResolver(context, logger);
context.subscriptions.push(vscode.workspace.registerRemoteAuthorityResolver(REMOTE_SSH_AUTHORITY, remoteSSHResolver));
context.subscriptions.push(remoteSSHResolver);
const locationHistory = new RemoteLocationHistory(context);
const locationData = getRemoteWorkspaceLocationData();
if (locationData) {
await locationHistory.addLocation(locationData[0], locationData[1]);
}
const hostTreeDataProvider = new HostTreeDataProvider(locationHistory);
context.subscriptions.push(vscode.window.createTreeView('sshHosts', { treeDataProvider: hostTreeDataProvider }));
context.subscriptions.push(hostTreeDataProvider);
context.subscriptions.push(vscode.commands.registerCommand('openremotessh.openEmptyWindow', () => promptOpenRemoteSSHWindow(false)));
context.subscriptions.push(vscode.commands.registerCommand('openremotessh.openEmptyWindowInCurrentWindow', () => promptOpenRemoteSSHWindow(true)));
context.subscriptions.push(vscode.commands.registerCommand('openremotessh.openConfigFile', () => openSSHConfigFile()));
context.subscriptions.push(vscode.commands.registerCommand('openremotessh.showLog', () => logger.show()));
}
export function deactivate() {
}
@@ -0,0 +1,109 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import * as path from 'path';
import SSHConfiguration, { getSSHConfigPath } from './ssh/sshConfig';
import { RemoteLocationHistory } from './remoteLocationHistory';
import { Disposable } from './common/disposable';
import { addNewHost, openRemoteSSHLocationWindow, openRemoteSSHWindow, openSSHConfigFile } from './commands';
import SSHDestination from './ssh/sshDestination';
class HostItem {
constructor(
public hostname: string,
public locations: string[]
) {
}
}
class HostLocationItem {
constructor(
public path: string,
public hostname: string
) {
}
}
type DataTreeItem = HostItem | HostLocationItem;
export class HostTreeDataProvider extends Disposable implements vscode.TreeDataProvider<DataTreeItem> {
private readonly _onDidChangeTreeData = this._register(new vscode.EventEmitter<DataTreeItem | DataTreeItem[] | void>());
public readonly onDidChangeTreeData = this._onDidChangeTreeData.event;
constructor(
private locationHistory: RemoteLocationHistory
) {
super();
this._register(vscode.commands.registerCommand('openremotessh.explorer.add', () => addNewHost()));
this._register(vscode.commands.registerCommand('openremotessh.explorer.configure', () => openSSHConfigFile()));
this._register(vscode.commands.registerCommand('openremotessh.explorer.refresh', () => this.refresh()));
this._register(vscode.commands.registerCommand('openremotessh.explorer.emptyWindowInNewWindow', e => this.openRemoteSSHWindow(e, false)));
this._register(vscode.commands.registerCommand('openremotessh.explorer.emptyWindowInCurrentWindow', e => this.openRemoteSSHWindow(e, true)));
this._register(vscode.commands.registerCommand('openremotessh.explorer.reopenFolderInNewWindow', e => this.openRemoteSSHLocationWindow(e, false)));
this._register(vscode.commands.registerCommand('openremotessh.explorer.reopenFolderInCurrentWindow', e => this.openRemoteSSHLocationWindow(e, true)));
this._register(vscode.commands.registerCommand('openremotessh.explorer.deleteFolderHistoryItem', e => this.deleteHostLocation(e)));
this._register(vscode.workspace.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('remote.SSH.configFile')) {
this.refresh();
}
}));
this._register(vscode.workspace.onDidSaveTextDocument(e => {
if (e.uri.fsPath === getSSHConfigPath()) {
this.refresh();
}
}));
}
getTreeItem(element: DataTreeItem): vscode.TreeItem {
if (element instanceof HostLocationItem) {
const label = path.posix.basename(element.path).replace(/\.code-workspace$/, ' (Workspace)');
const treeItem = new vscode.TreeItem(label);
treeItem.description = path.posix.dirname(element.path);
treeItem.iconPath = new vscode.ThemeIcon('folder');
treeItem.contextValue = 'openremotessh.explorer.folder';
return treeItem;
}
const treeItem = new vscode.TreeItem(element.hostname);
treeItem.collapsibleState = element.locations.length ? vscode.TreeItemCollapsibleState.Collapsed : vscode.TreeItemCollapsibleState.None;
treeItem.iconPath = new vscode.ThemeIcon('vm');
treeItem.contextValue = 'openremotessh.explorer.host';
return treeItem;
}
async getChildren(element?: HostItem): Promise<DataTreeItem[]> {
if (!element) {
const sshConfigFile = await SSHConfiguration.loadFromFS();
const hosts = sshConfigFile.getAllConfiguredHosts();
return hosts.map(hostname => new HostItem(hostname, this.locationHistory.getHistory(hostname)));
}
if (element instanceof HostItem) {
return element.locations.map(location => new HostLocationItem(location, element.hostname));
}
return [];
}
private refresh() {
this._onDidChangeTreeData.fire();
}
private async deleteHostLocation(element: HostLocationItem) {
await this.locationHistory.removeLocation(element.hostname, element.path);
this.refresh();
}
private async openRemoteSSHWindow(element: HostItem, reuseWindow: boolean) {
const sshDest = new SSHDestination(element.hostname);
openRemoteSSHWindow(sshDest.toEncodedString(), reuseWindow);
}
private async openRemoteSSHLocationWindow(element: HostLocationItem, reuseWindow: boolean) {
const sshDest = new SSHDestination(element.hostname);
openRemoteSSHLocationWindow(sshDest.toEncodedString(), element.path, reuseWindow);
}
}
@@ -0,0 +1,58 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { REMOTE_SSH_AUTHORITY } from './authResolver';
import SSHDestination from './ssh/sshDestination';
export class RemoteLocationHistory {
private static STORAGE_KEY = 'remoteLocationHistory_v0';
private remoteLocationHistory: Record<string, string[]> = {};
constructor(private context: vscode.ExtensionContext) {
// context.globalState.update(RemoteLocationHistory.STORAGE_KEY, undefined);
this.remoteLocationHistory = context.globalState.get(RemoteLocationHistory.STORAGE_KEY) || {};
}
getHistory(host: string): string[] {
return this.remoteLocationHistory[host] || [];
}
async addLocation(host: string, path: string) {
const hostLocations = this.remoteLocationHistory[host] || [];
if (!hostLocations.includes(path)) {
hostLocations.unshift(path);
this.remoteLocationHistory[host] = hostLocations;
await this.context.globalState.update(RemoteLocationHistory.STORAGE_KEY, this.remoteLocationHistory);
}
}
async removeLocation(host: string, path: string) {
let hostLocations = this.remoteLocationHistory[host] || [];
hostLocations = hostLocations.filter(l => l !== path);
this.remoteLocationHistory[host] = hostLocations;
await this.context.globalState.update(RemoteLocationHistory.STORAGE_KEY, this.remoteLocationHistory);
}
}
export function getRemoteWorkspaceLocationData(): [string, string] | undefined {
let location = vscode.workspace.workspaceFile;
if (location && location.scheme === 'vscode-remote' && location.authority.startsWith(REMOTE_SSH_AUTHORITY) && location.path.endsWith('.code-workspace')) {
const [, host] = location.authority.split('+');
const sshDest = SSHDestination.parseEncoded(host);
return [sshDest.hostname, location.path];
}
location = vscode.workspace.workspaceFolders?.[0].uri;
if (location && location.scheme === 'vscode-remote' && location.authority.startsWith(REMOTE_SSH_AUTHORITY)) {
const [, host] = location.authority.split('+');
const sshDest = SSHDestination.parseEncoded(host);
return [sshDest.hostname, location.path];
}
return undefined;
}
@@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import * as fs from 'fs';
import * as path from 'path';
let vscodeProductJson: any;
async function getVSCodeProductJson() {
if (!vscodeProductJson) {
const productJsonStr = await fs.promises.readFile(path.join(vscode.env.appRoot, 'product.json'), 'utf8');
vscodeProductJson = JSON.parse(productJsonStr);
}
return vscodeProductJson;
}
export interface IServerConfig {
version: string;
commit: string;
quality: string;
release?: string; // void-like specific
serverApplicationName: string;
serverDataFolderName: string;
serverDownloadUrlTemplate?: string; // void-like specific
}
export async function getVSCodeServerConfig(): Promise<IServerConfig> {
const productJson = await getVSCodeProductJson();
const customServerBinaryName = vscode.workspace.getConfiguration('remote.SSH.experimental').get<string>('serverBinaryName', '');
return {
version: vscode.version.replace('-insider', ''),
commit: productJson.commit,
quality: productJson.quality,
release: productJson.release,
serverApplicationName: customServerBinaryName || productJson.serverApplicationName,
serverDataFolderName: productJson.serverDataFolderName,
serverDownloadUrlTemplate: productJson.serverDownloadUrlTemplate
};
}
@@ -0,0 +1,626 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as crypto from 'crypto';
import Log from './common/logger';
import { getVSCodeServerConfig } from './serverConfig';
import SSHConnection from './ssh/sshConnection';
export interface ServerInstallOptions {
id: string;
quality: string;
commit: string;
version: string;
release?: string; // void specific
extensionIds: string[];
envVariables: string[];
useSocketPath: boolean;
serverApplicationName: string;
serverDataFolderName: string;
serverDownloadUrlTemplate: string;
}
export interface ServerInstallResult {
exitCode: number;
listeningOn: number | string;
connectionToken: string;
logFile: string;
osReleaseId: string;
arch: string;
platform: string;
tmpDir: string;
[key: string]: any;
}
export class ServerInstallError extends Error {
constructor(message: string) {
super(message);
}
}
const DEFAULT_DOWNLOAD_URL_TEMPLATE = 'https://github.com/voideditor/void-updates-server/releases/download/test/void-server-${os}-${arch}.tar.gz';
export async function installCodeServer(conn: SSHConnection, serverDownloadUrlTemplate: string | undefined, extensionIds: string[], envVariables: string[], platform: string | undefined, useSocketPath: boolean, logger: Log): Promise<ServerInstallResult> {
let shell = 'powershell';
// detect platform and shell for windows
if (!platform || platform === 'windows') {
const result = await conn.exec('uname -s');
if (result.stdout) {
if (result.stdout.includes('windows32')) {
platform = 'windows';
} else if (result.stdout.includes('MINGW64')) {
platform = 'windows';
shell = 'bash';
}
} else if (result.stderr) {
if (result.stderr.includes('FullyQualifiedErrorId : CommandNotFoundException')) {
platform = 'windows';
}
if (result.stderr.includes('is not recognized as an internal or external command')) {
platform = 'windows';
shell = 'cmd';
}
}
if (platform) {
logger.trace(`Detected platform: ${platform}, ${shell}`);
}
}
const scriptId = crypto.randomBytes(12).toString('hex');
const vscodeServerConfig = await getVSCodeServerConfig();
const installOptions: ServerInstallOptions = {
id: scriptId,
version: vscodeServerConfig.version,
commit: vscodeServerConfig.commit,
quality: vscodeServerConfig.quality,
release: vscodeServerConfig.release,
extensionIds,
envVariables,
useSocketPath,
serverApplicationName: vscodeServerConfig.serverApplicationName,
serverDataFolderName: vscodeServerConfig.serverDataFolderName,
serverDownloadUrlTemplate: serverDownloadUrlTemplate ?? vscodeServerConfig.serverDownloadUrlTemplate ?? DEFAULT_DOWNLOAD_URL_TEMPLATE,
};
let commandOutput: { stdout: string; stderr: string };
if (platform === 'windows') {
const installServerScript = generatePowerShellInstallScript(installOptions);
logger.trace('Server install command:', installServerScript);
const installDir = `$HOME\\${vscodeServerConfig.serverDataFolderName}\\install`;
const installScript = `${installDir}\\${vscodeServerConfig.commit}.ps1`;
const endRegex = new RegExp(`${scriptId}: end`);
// investigate if it's possible to use `-EncodedCommand` flag
// https://devblogs.microsoft.com/powershell/invoking-powershell-with-complex-expressions-using-scriptblocks/
let command = '';
if (shell === 'powershell') {
command = `md -Force ${installDir}; echo @'\n${installServerScript}\n'@ | Set-Content ${installScript}; powershell -ExecutionPolicy ByPass -File "${installScript}"`;
} else if (shell === 'bash') {
command = `mkdir -p ${installDir.replace(/\\/g, '/')} && echo '\n${installServerScript.replace(/'/g, '\'"\'"\'')}\n' > ${installScript.replace(/\\/g, '/')} && powershell -ExecutionPolicy ByPass -File "${installScript}"`;
} else if (shell === 'cmd') {
const script = installServerScript.trim()
// remove comments
.replace(/^#.*$/gm, '')
// remove empty lines
.replace(/\n{2,}/gm, '\n')
// remove leading spaces
.replace(/^\s*/gm, '')
// escape double quotes (from powershell/cmd)
.replace(/"/g, '"""')
// escape single quotes (from cmd)
.replace(/'/g, `''`)
// escape redirect (from cmd)
.replace(/>/g, `^>`)
// escape new lines (from powershell/cmd)
.replace(/\n/g, '\'`n\'');
command = `powershell "md -Force ${installDir}" && powershell "echo '${script}'" > ${installScript.replace('$HOME', '%USERPROFILE%')} && powershell -ExecutionPolicy ByPass -File "${installScript.replace('$HOME', '%USERPROFILE%')}"`;
logger.trace('Command length (8191 max):', command.length);
if (command.length > 8191) {
throw new ServerInstallError(`Command line too long`);
}
} else {
throw new ServerInstallError(`Not supported shell: ${shell}`);
}
commandOutput = await conn.execPartial(command, (stdout: string) => endRegex.test(stdout));
} else {
const installServerScript = generateBashInstallScript(installOptions);
logger.trace('Server install command:', installServerScript);
// Fish shell does not support heredoc so let's workaround it using -c option,
// also replace single quotes (') within the script with ('\'') as there's no quoting within single quotes, see https://unix.stackexchange.com/a/24676
commandOutput = await conn.exec(`bash -c '${installServerScript.replace(/'/g, `'\\''`)}'`);
}
if (commandOutput.stderr) {
logger.trace('Server install command stderr:', commandOutput.stderr);
}
logger.trace('Server install command stdout:', commandOutput.stdout);
const resultMap = parseServerInstallOutput(commandOutput.stdout, scriptId);
if (!resultMap) {
throw new ServerInstallError(`Failed parsing install script output`);
}
const exitCode = parseInt(resultMap.exitCode, 10);
if (exitCode !== 0) {
throw new ServerInstallError(`Couldn't install vscode server on remote server, install script returned non-zero exit status`);
}
const listeningOn = resultMap.listeningOn.match(/^\d+$/)
? parseInt(resultMap.listeningOn, 10)
: resultMap.listeningOn;
const remoteEnvVars = Object.fromEntries(Object.entries(resultMap).filter(([key,]) => envVariables.includes(key)));
return {
exitCode,
listeningOn,
connectionToken: resultMap.connectionToken,
logFile: resultMap.logFile,
osReleaseId: resultMap.osReleaseId,
arch: resultMap.arch,
platform: resultMap.platform,
tmpDir: resultMap.tmpDir,
...remoteEnvVars
};
}
function parseServerInstallOutput(str: string, scriptId: string): { [k: string]: string } | undefined {
const startResultStr = `${scriptId}: start`;
const endResultStr = `${scriptId}: end`;
const startResultIdx = str.indexOf(startResultStr);
if (startResultIdx < 0) {
return undefined;
}
const endResultIdx = str.indexOf(endResultStr, startResultIdx + startResultStr.length);
if (endResultIdx < 0) {
return undefined;
}
const installResult = str.substring(startResultIdx + startResultStr.length, endResultIdx);
const resultMap: { [k: string]: string } = {};
const resultArr = installResult.split(/\r?\n/);
for (const line of resultArr) {
const [key, value] = line.split('==');
resultMap[key] = value;
}
return resultMap;
}
function generateBashInstallScript({ id, quality, version, commit, release, extensionIds, envVariables, useSocketPath, serverApplicationName, serverDataFolderName, serverDownloadUrlTemplate }: ServerInstallOptions) {
const extensions = extensionIds.map(id => '--install-extension ' + id).join(' ');
return `
# Server installation script
TMP_DIR="\${XDG_RUNTIME_DIR:-"/tmp"}"
DISTRO_VERSION="${version}"
DISTRO_COMMIT="${commit}"
DISTRO_QUALITY="${quality}"
DISTRO_VOID_RELEASE="${release ?? ''}"
SERVER_APP_NAME="${serverApplicationName}"
SERVER_INITIAL_EXTENSIONS="${extensions}"
SERVER_LISTEN_FLAG="${useSocketPath ? `--socket-path="$TMP_DIR/vscode-server-sock-${crypto.randomUUID()}"` : '--port=0'}"
SERVER_DATA_DIR="$HOME/${serverDataFolderName}"
SERVER_DIR="$SERVER_DATA_DIR/bin/$DISTRO_COMMIT"
SERVER_SCRIPT="$SERVER_DIR/bin/$SERVER_APP_NAME"
SERVER_LOGFILE="$SERVER_DATA_DIR/.$DISTRO_COMMIT.log"
SERVER_PIDFILE="$SERVER_DATA_DIR/.$DISTRO_COMMIT.pid"
SERVER_TOKENFILE="$SERVER_DATA_DIR/.$DISTRO_COMMIT.token"
SERVER_ARCH=
SERVER_CONNECTION_TOKEN=
SERVER_DOWNLOAD_URL=
LISTENING_ON=
OS_RELEASE_ID=
ARCH=
PLATFORM=
# Mimic output from logs of remote-ssh extension
print_install_results_and_exit() {
echo "${id}: start"
echo "exitCode==$1=="
echo "listeningOn==$LISTENING_ON=="
echo "connectionToken==$SERVER_CONNECTION_TOKEN=="
echo "logFile==$SERVER_LOGFILE=="
echo "osReleaseId==$OS_RELEASE_ID=="
echo "arch==$ARCH=="
echo "platform==$PLATFORM=="
echo "tmpDir==$TMP_DIR=="
${envVariables.map(envVar => `echo "${envVar}==$${envVar}=="`).join('\n')}
echo "${id}: end"
exit 0
}
# Check if platform is supported
KERNEL="$(uname -s)"
case $KERNEL in
Darwin)
PLATFORM="darwin"
;;
Linux)
PLATFORM="linux"
;;
FreeBSD)
PLATFORM="freebsd"
;;
DragonFly)
PLATFORM="dragonfly"
;;
*)
echo "Error platform not supported: $KERNEL"
print_install_results_and_exit 1
;;
esac
# Check machine architecture
ARCH="$(uname -m)"
case $ARCH in
x86_64 | amd64)
SERVER_ARCH="x64"
;;
armv7l | armv8l)
SERVER_ARCH="armhf"
;;
arm64 | aarch64)
SERVER_ARCH="arm64"
;;
ppc64le)
SERVER_ARCH="ppc64le"
;;
riscv64)
SERVER_ARCH="riscv64"
;;
loongarch64)
SERVER_ARCH="loong64"
;;
s390x)
SERVER_ARCH="s390x"
;;
*)
echo "Error architecture not supported: $ARCH"
print_install_results_and_exit 1
;;
esac
# https://www.freedesktop.org/software/systemd/man/os-release.html
OS_RELEASE_ID="$(grep -i '^ID=' /etc/os-release 2>/dev/null | sed 's/^ID=//gi' | sed 's/"//g')"
if [[ -z $OS_RELEASE_ID ]]; then
OS_RELEASE_ID="$(grep -i '^ID=' /usr/lib/os-release 2>/dev/null | sed 's/^ID=//gi' | sed 's/"//g')"
if [[ -z $OS_RELEASE_ID ]]; then
OS_RELEASE_ID="unknown"
fi
fi
# Create installation folder
if [[ ! -d $SERVER_DIR ]]; then
mkdir -p $SERVER_DIR
if (( $? > 0 )); then
echo "Error creating server install directory"
print_install_results_and_exit 1
fi
fi
# adjust platform for void download, if needed
if [[ $OS_RELEASE_ID = alpine ]]; then
PLATFORM=$OS_RELEASE_ID
fi
SERVER_DOWNLOAD_URL="$(echo "${serverDownloadUrlTemplate.replace(/\$\{/g, '\\${')}" | sed "s/\\\${quality}/$DISTRO_QUALITY/g" | sed "s/\\\${version}/$DISTRO_VERSION/g" | sed "s/\\\${commit}/$DISTRO_COMMIT/g" | sed "s/\\\${os}/$PLATFORM/g" | sed "s/\\\${arch}/$SERVER_ARCH/g" | sed "s/\\\${release}/$DISTRO_VOID_RELEASE/g")"
# Check if server script is already installed
if [[ ! -f $SERVER_SCRIPT ]]; then
case "$PLATFORM" in
darwin | linux | alpine )
;;
*)
echo "Error '$PLATFORM' needs manual installation of remote extension host"
print_install_results_and_exit 1
;;
esac
pushd $SERVER_DIR > /dev/null
if [[ ! -z $(which wget) ]]; then
wget --tries=3 --timeout=10 --continue --no-verbose -O vscode-server.tar.gz $SERVER_DOWNLOAD_URL
elif [[ ! -z $(which curl) ]]; then
curl --retry 3 --connect-timeout 10 --location --show-error --silent --output vscode-server.tar.gz $SERVER_DOWNLOAD_URL
else
echo "Error no tool to download server binary"
print_install_results_and_exit 1
fi
if (( $? > 0 )); then
echo "Error downloading server from $SERVER_DOWNLOAD_URL"
print_install_results_and_exit 1
fi
tar -xf vscode-server.tar.gz --strip-components 1
if (( $? > 0 )); then
echo "Error while extracting server contents"
print_install_results_and_exit 1
fi
if [[ ! -f $SERVER_SCRIPT ]]; then
echo "Error server contents are corrupted"
print_install_results_and_exit 1
fi
rm -f vscode-server.tar.gz
popd > /dev/null
else
echo "Server script already installed in $SERVER_SCRIPT"
fi
# Try to find if server is already running
if [[ -f $SERVER_PIDFILE ]]; then
SERVER_PID="$(cat $SERVER_PIDFILE)"
SERVER_RUNNING_PROCESS="$(ps -o pid,args -p $SERVER_PID | grep $SERVER_SCRIPT)"
else
SERVER_RUNNING_PROCESS="$(ps -o pid,args -A | grep $SERVER_SCRIPT | grep -v grep)"
fi
if [[ -z $SERVER_RUNNING_PROCESS ]]; then
if [[ -f $SERVER_LOGFILE ]]; then
rm $SERVER_LOGFILE
fi
if [[ -f $SERVER_TOKENFILE ]]; then
rm $SERVER_TOKENFILE
fi
touch $SERVER_TOKENFILE
chmod 600 $SERVER_TOKENFILE
SERVER_CONNECTION_TOKEN="${crypto.randomUUID()}"
echo $SERVER_CONNECTION_TOKEN > $SERVER_TOKENFILE
$SERVER_SCRIPT --start-server --host=127.0.0.1 $SERVER_LISTEN_FLAG $SERVER_INITIAL_EXTENSIONS --connection-token-file $SERVER_TOKENFILE --telemetry-level off --enable-remote-auto-shutdown --accept-server-license-terms &> $SERVER_LOGFILE &
echo $! > $SERVER_PIDFILE
else
echo "Server script is already running $SERVER_SCRIPT"
fi
if [[ -f $SERVER_TOKENFILE ]]; then
SERVER_CONNECTION_TOKEN="$(cat $SERVER_TOKENFILE)"
else
echo "Error server token file not found $SERVER_TOKENFILE"
print_install_results_and_exit 1
fi
if [[ -f $SERVER_LOGFILE ]]; then
for i in {1..5}; do
LISTENING_ON="$(cat $SERVER_LOGFILE | grep -E 'Extension host agent listening on .+' | sed 's/Extension host agent listening on //')"
if [[ -n $LISTENING_ON ]]; then
break
fi
sleep 0.5
done
if [[ -z $LISTENING_ON ]]; then
echo "Error server did not start successfully"
print_install_results_and_exit 1
fi
else
echo "Error server log file not found $SERVER_LOGFILE"
print_install_results_and_exit 1
fi
# Finish server setup
print_install_results_and_exit 0
`;
}
function generatePowerShellInstallScript({ id, quality, version, commit, release, extensionIds, envVariables, useSocketPath, serverApplicationName, serverDataFolderName, serverDownloadUrlTemplate }: ServerInstallOptions) {
const extensions = extensionIds.map(id => '--install-extension ' + id).join(' ');
const downloadUrl = serverDownloadUrlTemplate
.replace(/\$\{quality\}/g, quality)
.replace(/\$\{version\}/g, version)
.replace(/\$\{commit\}/g, commit)
.replace(/\$\{os\}/g, 'win32')
.replace(/\$\{arch\}/g, 'x64')
.replace(/\$\{release\}/g, release ?? '');
return `
# Server installation script
$TMP_DIR="$env:TEMP\\$([System.IO.Path]::GetRandomFileName())"
$ProgressPreference = "SilentlyContinue"
$DISTRO_VERSION="${version}"
$DISTRO_COMMIT="${commit}"
$DISTRO_QUALITY="${quality}"
$DISTRO_VOID_RELEASE="${release ?? ''}"
$SERVER_APP_NAME="${serverApplicationName}"
$SERVER_INITIAL_EXTENSIONS="${extensions}"
$SERVER_LISTEN_FLAG="${useSocketPath ? `--socket-path="$TMP_DIR/vscode-server-sock-${crypto.randomUUID()}"` : '--port=0'}"
$SERVER_DATA_DIR="$(Resolve-Path ~)\\${serverDataFolderName}"
$SERVER_DIR="$SERVER_DATA_DIR\\bin\\$DISTRO_COMMIT"
$SERVER_SCRIPT="$SERVER_DIR\\bin\\$SERVER_APP_NAME.cmd"
$SERVER_LOGFILE="$SERVER_DATA_DIR\\.$DISTRO_COMMIT.log"
$SERVER_PIDFILE="$SERVER_DATA_DIR\\.$DISTRO_COMMIT.pid"
$SERVER_TOKENFILE="$SERVER_DATA_DIR\\.$DISTRO_COMMIT.token"
$SERVER_ARCH=
$SERVER_CONNECTION_TOKEN=
$SERVER_DOWNLOAD_URL=
$LISTENING_ON=
$OS_RELEASE_ID=
$ARCH=
$PLATFORM="win32"
function printInstallResults($code) {
"${id}: start"
"exitCode==$code=="
"listeningOn==$LISTENING_ON=="
"connectionToken==$SERVER_CONNECTION_TOKEN=="
"logFile==$SERVER_LOGFILE=="
"osReleaseId==$OS_RELEASE_ID=="
"arch==$ARCH=="
"platform==$PLATFORM=="
"tmpDir==$TMP_DIR=="
${envVariables.map(envVar => `"${envVar}==$${envVar}=="`).join('\n')}
"${id}: end"
}
# Check machine architecture
$ARCH=$env:PROCESSOR_ARCHITECTURE
# Use x64 version for ARM64, as it's not yet available.
if(($ARCH -eq "AMD64") -or ($ARCH -eq "IA64") -or ($ARCH -eq "ARM64")) {
$SERVER_ARCH="x64"
}
else {
"Error architecture not supported: $ARCH"
printInstallResults 1
exit 0
}
# Create installation folder
if(!(Test-Path $SERVER_DIR)) {
try {
ni -it d $SERVER_DIR -f -ea si
} catch {
"Error creating server install directory - $($_.ToString())"
exit 1
}
if(!(Test-Path $SERVER_DIR)) {
"Error creating server install directory"
exit 1
}
}
cd $SERVER_DIR
# Check if server script is already installed
if(!(Test-Path $SERVER_SCRIPT)) {
del vscode-server.tar.gz
$REQUEST_ARGUMENTS = @{
Uri="${downloadUrl}"
TimeoutSec=20
OutFile="vscode-server.tar.gz"
UseBasicParsing=$True
}
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-RestMethod @REQUEST_ARGUMENTS
if(Test-Path "vscode-server.tar.gz") {
tar -xf vscode-server.tar.gz --strip-components 1
del vscode-server.tar.gz
}
if(!(Test-Path $SERVER_SCRIPT)) {
"Error while installing the server binary"
exit 1
}
}
else {
"Server script already installed in $SERVER_SCRIPT"
}
# Try to find if server is already running
if(Get-Process node -ErrorAction SilentlyContinue | Where-Object Path -Like "$SERVER_DIR\\*") {
echo "Server script is already running $SERVER_SCRIPT"
}
else {
if(Test-Path $SERVER_LOGFILE) {
del $SERVER_LOGFILE
}
if(Test-Path $SERVER_PIDFILE) {
del $SERVER_PIDFILE
}
if(Test-Path $SERVER_TOKENFILE) {
del $SERVER_TOKENFILE
}
$SERVER_CONNECTION_TOKEN="${crypto.randomUUID()}"
[System.IO.File]::WriteAllLines($SERVER_TOKENFILE, $SERVER_CONNECTION_TOKEN)
$SCRIPT_ARGUMENTS="--start-server --host=127.0.0.1 $SERVER_LISTEN_FLAG $SERVER_INITIAL_EXTENSIONS --connection-token-file $SERVER_TOKENFILE --telemetry-level off --enable-remote-auto-shutdown --accept-server-license-terms *> '$SERVER_LOGFILE'"
$START_ARGUMENTS = @{
FilePath = "powershell.exe"
WindowStyle = "hidden"
ArgumentList = @(
"-ExecutionPolicy", "Unrestricted", "-NoLogo", "-NoProfile", "-NonInteractive", "-c", "$SERVER_SCRIPT $SCRIPT_ARGUMENTS"
)
PassThru = $True
}
$SERVER_ID = (start @START_ARGUMENTS).ID
if($SERVER_ID) {
[System.IO.File]::WriteAllLines($SERVER_PIDFILE, $SERVER_ID)
}
}
if(Test-Path $SERVER_TOKENFILE) {
$SERVER_CONNECTION_TOKEN="$(cat $SERVER_TOKENFILE)"
}
else {
"Error server token file not found $SERVER_TOKENFILE"
printInstallResults 1
exit 0
}
sleep -Milliseconds 500
$SELECT_ARGUMENTS = @{
Path = $SERVER_LOGFILE
Pattern = "Extension host agent listening on (\\d+)"
}
for($I = 1; $I -le 5; $I++) {
if(Test-Path $SERVER_LOGFILE) {
$GROUPS = (Select-String @SELECT_ARGUMENTS).Matches.Groups
if($GROUPS) {
$LISTENING_ON = $GROUPS[1].Value
break
}
}
sleep -Milliseconds 500
}
if(!(Test-Path $SERVER_LOGFILE)) {
"Error server log file not found $SERVER_LOGFILE"
printInstallResults 1
exit 0
}
# Finish server setup
printInstallResults 0
if($SERVER_ID) {
while($True) {
if(!(gps -Id $SERVER_ID)) {
"server died, exit"
exit 0
}
sleep 30
}
}
`;
}
@@ -0,0 +1,46 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as os from 'os';
import * as fs from 'fs';
import * as path from 'path';
import * as crypto from 'crypto';
import { exists as folderExists } from '../common/files';
const PATH_SSH_USER_DIR = path.join(os.homedir(), '.ssh');
const KNOW_HOST_FILE = path.join(PATH_SSH_USER_DIR, 'known_hosts');
const HASH_MAGIC = '|1|';
const HASH_DELIM = '|';
export async function checkNewHostInHostkeys(host: string): Promise<boolean> {
const fileContent = await fs.promises.readFile(KNOW_HOST_FILE, { encoding: 'utf8' });
const lines = fileContent.split(/\r?\n/);
for (let line of lines) {
line = line.trim();
if (!line.startsWith(HASH_MAGIC)) {
continue;
}
const [hostEncripted_] = line.split(' ');
const [salt_, hostHash_] = hostEncripted_.substring(HASH_MAGIC.length).split(HASH_DELIM);
const hostHash = crypto.createHmac('sha1', Buffer.from(salt_, 'base64')).update(host).digest();
if (hostHash.toString('base64') === hostHash_) {
return false;
}
}
return true;
}
export async function addHostToHostFile(host: string, hostKey: Buffer, type: string): Promise<void> {
if (!folderExists(PATH_SSH_USER_DIR)) {
await fs.promises.mkdir(PATH_SSH_USER_DIR, 0o700);
}
const salt = crypto.randomBytes(20);
const hostHash = crypto.createHmac('sha1', salt).update(host).digest();
const entry = `${HASH_MAGIC}${salt.toString('base64')}${HASH_DELIM}${hostHash.toString('base64')} ${type} ${hostKey.toString('base64')}\n`;
await fs.promises.appendFile(KNOW_HOST_FILE, entry);
}
@@ -0,0 +1,120 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import * as crypto from 'crypto';
import type { ParsedKey } from 'ssh2-streams';
import * as ssh2 from 'ssh2';
import { untildify, exists as fileExists } from '../common/files';
import Log from '../common/logger';
const homeDir = os.homedir();
const PATH_SSH_CLIENT_ID_DSA = path.join(homeDir, '.ssh', '/id_dsa');
const PATH_SSH_CLIENT_ID_ECDSA = path.join(homeDir, '.ssh', '/id_ecdsa');
const PATH_SSH_CLIENT_ID_RSA = path.join(homeDir, '.ssh', '/id_rsa');
const PATH_SSH_CLIENT_ID_ED25519 = path.join(homeDir, '.ssh', '/id_ed25519');
const PATH_SSH_CLIENT_ID_XMSS = path.join(homeDir, '.ssh', '/id_xmss');
const PATH_SSH_CLIENT_ID_ECDSA_SK = path.join(homeDir, '.ssh', '/id_ecdsa_sk');
const PATH_SSH_CLIENT_ID_ED25519_SK = path.join(homeDir, '.ssh', '/id_ed25519_sk');
const DEFAULT_IDENTITY_FILES: string[] = [
PATH_SSH_CLIENT_ID_RSA,
PATH_SSH_CLIENT_ID_ECDSA,
PATH_SSH_CLIENT_ID_ECDSA_SK,
PATH_SSH_CLIENT_ID_ED25519,
PATH_SSH_CLIENT_ID_ED25519_SK,
PATH_SSH_CLIENT_ID_XMSS,
PATH_SSH_CLIENT_ID_DSA,
];
export interface SSHKey {
filename: string;
parsedKey: ParsedKey;
fingerprint: string;
agentSupport?: boolean;
isPrivate?: boolean;
}
// From https://github.com/openssh/openssh-portable/blob/acb2059febaddd71ee06c2ebf63dcf211d9ab9f2/sshconnect2.c#L1689-L1690
export async function gatherIdentityFiles(identityFiles: string[], sshAgentSock: string | undefined, identitiesOnly: boolean, logger: Log) {
identityFiles = identityFiles.map(untildify).map(i => i.replace(/\.pub$/, ''));
if (identityFiles.length === 0) {
identityFiles.push(...DEFAULT_IDENTITY_FILES);
}
const identityFileContentsResult = await Promise.allSettled(identityFiles.map(async keyPath => {
keyPath = await fileExists(keyPath + '.pub') ? keyPath + '.pub' : keyPath;
return fs.promises.readFile(keyPath);
}));
const fileKeys: SSHKey[] = identityFileContentsResult.map((result, i) => {
if (result.status === 'rejected') {
return undefined;
}
const parsedResult = ssh2.utils.parseKey(result.value);
if (parsedResult instanceof Error || !parsedResult) {
logger.error(`Error while parsing SSH public key ${identityFiles[i]}:`, parsedResult);
return undefined;
}
const parsedKey = Array.isArray(parsedResult) ? parsedResult[0] : parsedResult;
const fingerprint = crypto.createHash('sha256').update(parsedKey.getPublicSSH()).digest('base64');
return {
filename: identityFiles[i],
parsedKey,
fingerprint
};
}).filter(<T>(v: T | undefined): v is T => !!v);
let sshAgentParsedKeys: ParsedKey[] = [];
try {
if (!sshAgentSock) {
throw new Error(`SSH_AUTH_SOCK environment variable not defined`);
}
sshAgentParsedKeys = await new Promise<ParsedKey[]>((resolve, reject) => {
const sshAgent = new ssh2.OpenSSHAgent(sshAgentSock);
sshAgent.getIdentities((err, publicKeys) => {
if (err) {
reject(err);
} else {
resolve(publicKeys || []);
}
});
});
} catch (e) {
logger.error(`Couldn't get identities from OpenSSH agent`, e);
}
const sshAgentKeys: SSHKey[] = sshAgentParsedKeys.map(parsedKey => {
const fingerprint = crypto.createHash('sha256').update(parsedKey.getPublicSSH()).digest('base64');
return {
filename: parsedKey.comment,
parsedKey,
fingerprint,
agentSupport: true
};
});
const agentKeys: SSHKey[] = [];
const preferredIdentityKeys: SSHKey[] = [];
for (const agentKey of sshAgentKeys) {
const foundIdx = fileKeys.findIndex(k => agentKey.parsedKey.type === k.parsedKey.type && agentKey.fingerprint === k.fingerprint);
if (foundIdx >= 0) {
preferredIdentityKeys.push({ ...fileKeys[foundIdx], agentSupport: true });
fileKeys.splice(foundIdx, 1);
} else if (!identitiesOnly) {
agentKeys.push(agentKey);
}
}
preferredIdentityKeys.push(...agentKeys);
preferredIdentityKeys.push(...fileKeys);
logger.trace(`Identity keys:`, preferredIdentityKeys.length ? preferredIdentityKeys.map(k => `${k.filename} ${k.parsedKey.type} SHA256:${k.fingerprint}`).join('\n') : 'None');
return preferredIdentityKeys;
}
@@ -0,0 +1,129 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as os from 'os';
import * as fs from 'fs';
import * as path from 'path';
import SSHConfig, { Directive, Line, Section } from '@jeanp413/ssh-config';
import * as vscode from 'vscode';
import { exists as fileExists, normalizeToSlash, untildify } from '../common/files';
import { isWindows } from '../common/platform';
import { glob } from 'glob';
const systemSSHConfig = isWindows ? path.resolve(process.env.ALLUSERSPROFILE || 'C:\\ProgramData', 'ssh\\ssh_config') : '/etc/ssh/ssh_config';
const defaultSSHConfigPath = path.resolve(os.homedir(), '.ssh/config');
export function getSSHConfigPath() {
const sshConfigPath = vscode.workspace.getConfiguration('remote.SSH').get<string>('configFile');
return sshConfigPath ? untildify(sshConfigPath) : defaultSSHConfigPath;
}
function isDirective(line: Line): line is Directive {
return line.type === SSHConfig.DIRECTIVE;
}
function isHostSection(line: Line): line is Section {
return isDirective(line) && line.param === 'Host' && !!line.value && !!(line as Section).config;
}
function isIncludeDirective(line: Line): line is Section {
return isDirective(line) && line.param === 'Include' && !!line.value;
}
const SSH_CONFIG_PROPERTIES: Record<string, string> = {
'host': 'Host',
'hostname': 'HostName',
'user': 'User',
'port': 'Port',
'identityagent': 'IdentityAgent',
'identitiesonly': 'IdentitiesOnly',
'identityfile': 'IdentityFile',
'forwardagent': 'ForwardAgent',
'preferredauthentications': 'PreferredAuthentications',
'proxyjump': 'ProxyJump',
'proxycommand': 'ProxyCommand',
'include': 'Include',
};
function normalizeProp(prop: Directive) {
prop.param = SSH_CONFIG_PROPERTIES[prop.param.toLowerCase()] || prop.param;
}
function normalizeSSHConfig(config: SSHConfig) {
for (const line of config) {
if (isDirective(line)) {
normalizeProp(line);
}
if (isHostSection(line)) {
normalizeSSHConfig(line.config);
}
}
return config;
}
async function parseSSHConfigFromFile(filePath: string, userConfig: boolean) {
let content = '';
if (await fileExists(filePath)) {
content = (await fs.promises.readFile(filePath, 'utf8')).trim();
}
const config = normalizeSSHConfig(SSHConfig.parse(content));
const includedConfigs: [number, SSHConfig[]][] = [];
for (let i = 0; i < config.length; i++) {
const line = config[i];
if (isIncludeDirective(line)) {
const values = (line.value as string).split(',').map(s => s.trim());
const configs: SSHConfig[] = [];
for (const value of values) {
const includePaths = await glob(normalizeToSlash(untildify(value)), {
absolute: true,
cwd: normalizeToSlash(path.dirname(userConfig ? defaultSSHConfigPath : systemSSHConfig))
});
for (const p of includePaths) {
configs.push(await parseSSHConfigFromFile(p, userConfig));
}
}
includedConfigs.push([i, configs]);
}
}
for (const [idx, includeConfigs] of includedConfigs.reverse()) {
config.splice(idx, 1, ...includeConfigs.flat());
}
return config;
}
export default class SSHConfiguration {
static async loadFromFS(): Promise<SSHConfiguration> {
const config = await parseSSHConfigFromFile(getSSHConfigPath(), true);
config.push(...await parseSSHConfigFromFile(systemSSHConfig, false));
return new SSHConfiguration(config);
}
constructor(private sshConfig: SSHConfig) {
}
getAllConfiguredHosts(): string[] {
const hosts = new Set<string>();
for (const line of this.sshConfig) {
if (isHostSection(line)) {
const value = Array.isArray(line.value) ? line.value[0] : line.value;
const isPattern = /^!/.test(value) || /[?*]/.test(value);
if (!isPattern) {
hosts.add(value);
}
}
}
return [...hosts.keys()];
}
getHostConfiguration(host: string): Record<string, string> {
// Only a few directives return an array
// https://github.com/jeanp413/ssh-config/blob/8d187bb8f1d83a51ff2b1d127e6b6269d24092b5/src/ssh-config.ts#L9C1-L9C118
return this.sshConfig.compute(host) as Record<string, string>;
}
}
@@ -0,0 +1,367 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { EventEmitter } from 'events';
import * as net from 'net';
import * as fs from 'fs';
import * as stream from 'stream';
import { Client, ClientChannel, ClientErrorExtensions, ExecOptions, ShellOptions, ConnectConfig } from 'ssh2';
import { Server } from 'net';
import { SocksConnectionInfo, createServer as createSocksServer } from 'simple-socks';
export interface SSHConnectConfig extends ConnectConfig {
/** Optional Unique ID attached to ssh connection. */
uniqueId?: string;
/** Automatic retry to connect, after disconnect. Default true */
reconnect?: boolean;
/** Number of reconnect retry, after disconnect. Default 10 */
reconnectTries?: number;
/** Delay after which reconnect should be done. Default 5000ms */
reconnectDelay?: number;
/** Path to private key */
identity?: string | Buffer;
}
export interface SSHTunnelConfig {
/** Remote Address to connect */
remoteAddr?: string;
/** Local port to bind to. By default, it will bind to a random port, if not passed */
localPort?: number;
/** Remote Port to connect */
remotePort?: number;
/** Remote socket path to connect */
remoteSocketPath?: string;
socks?: boolean;
/** Unique name */
name?: string;
}
const defaultOptions: Partial<SSHConnectConfig> = {
reconnect: false,
port: 22,
reconnectTries: 3,
reconnectDelay: 5000
};
const SSHConstants = {
'CHANNEL': {
SSH: 'ssh',
TUNNEL: 'tunnel',
X11: 'x11'
},
'STATUS': {
BEFORECONNECT: 'beforeconnect',
CONNECT: 'connect',
BEFOREDISCONNECT: 'beforedisconnect',
DISCONNECT: 'disconnect'
}
};
export default class SSHConnection extends EventEmitter {
public config: SSHConnectConfig;
private activeTunnels: { [index: string]: SSHTunnelConfig & { server: Server } } = {};
private __$connectPromise: Promise<SSHConnection> | null = null;
private __retries: number = 0;
private __err: Error & ClientErrorExtensions & { code?: string } | null = null;
private sshConnection: Client | null = null;
constructor(options: SSHConnectConfig) {
super();
this.config = Object.assign({}, defaultOptions, options);
this.config.uniqueId = this.config.uniqueId || `${this.config.username}@${this.config.host}`;
}
/**
* Emit message on this channel
*/
override emit(channel: string, status: string, payload?: any): boolean {
super.emit(channel, status, this, payload);
return super.emit(`${channel}:${status}`, this, payload);
}
/**
* Get shell socket
*/
shell(options: ShellOptions = {}): Promise<ClientChannel> {
return this.connect().then(() => {
return new Promise<ClientChannel>((resolve, reject) => {
this.sshConnection!.shell(options, (err, stream) => err ? reject(err) : resolve(stream));
});
});
}
/**
* Exec a command
*/
exec(cmd: string, params?: Array<string>, options: ExecOptions = {}): Promise<{ stdout: string; stderr: string }> {
cmd += (Array.isArray(params) ? (' ' + params.join(' ')) : '');
return this.connect().then(() => {
return new Promise((resolve, reject) => {
this.sshConnection!.exec(cmd, options, (err, stream) => {
if (err) {
return reject(err);
}
let stdout = '';
let stderr = '';
stream.on('close', function () {
return resolve({ stdout, stderr });
}).on('data', function (data: Buffer | string) {
stdout += data.toString();
}).stderr.on('data', function (data: Buffer | string) {
stderr += data.toString();
});
});
});
});
}
/**
* Exec a command
*/
execPartial(cmd: string, tester: (stdout: string, stderr: string) => boolean, params?: Array<string>, options: ExecOptions = {}): Promise<{ stdout: string; stderr: string }> {
cmd += (Array.isArray(params) ? (' ' + params.join(' ')) : '');
return this.connect().then(() => {
return new Promise((resolve, reject) => {
this.sshConnection!.exec(cmd, options, (err, stream) => {
if (err) {
return reject(err);
}
let stdout = '';
let stderr = '';
let resolved = false;
stream.on('close', function () {
if (!resolved) {
return resolve({ stdout, stderr });
}
}).on('data', function (data: Buffer | string) {
stdout += data.toString();
if (tester(stdout, stderr)) {
resolved = true;
return resolve({ stdout, stderr });
}
}).stderr.on('data', function (data: Buffer | string) {
stderr += data.toString();
if (tester(stdout, stderr)) {
resolved = true;
return resolve({ stdout, stderr });
}
});
});
});
});
}
/**
* Forward out
*/
forwardOut(srcIP: string, srcPort: number, destIP: string, destPort: number): Promise<ClientChannel> {
return this.connect().then(() => {
return new Promise((resolve, reject) => {
this.sshConnection!.forwardOut(srcIP, srcPort, destIP, destPort, (err, stream) => {
if (err) {
return reject(err);
}
resolve(stream);
});
});
});
}
/**
* Get a Socks Port
*/
getSocksPort(localPort: number): Promise<number> {
return this.addTunnel({ name: '__socksServer', socks: true, localPort: localPort }).then((tunnel) => {
return tunnel.localPort!;
});
}
/**
* Close SSH Connection
*/
close(): Promise<void> {
this.emit(SSHConstants.CHANNEL.SSH, SSHConstants.STATUS.BEFOREDISCONNECT);
return this.closeTunnel().then(() => {
if (this.sshConnection) {
this.sshConnection.end();
this.emit(SSHConstants.CHANNEL.SSH, SSHConstants.STATUS.DISCONNECT);
}
});
}
/**
* Connect the SSH Connection
*/
connect(c?: SSHConnectConfig): Promise<SSHConnection> {
this.config = Object.assign(this.config, c);
++this.__retries;
if (this.__$connectPromise) {
return this.__$connectPromise;
}
this.__$connectPromise = new Promise((resolve, reject) => {
this.emit(SSHConstants.CHANNEL.SSH, SSHConstants.STATUS.BEFORECONNECT);
if (!this.config || typeof this.config === 'function' || !(this.config.host || this.config.sock) || !this.config.username) {
reject(`Invalid SSH connection configuration host/username can't be empty`);
this.__$connectPromise = null;
return;
}
if (this.config.identity) {
if (fs.existsSync(this.config.identity)) {
this.config.privateKey = fs.readFileSync(this.config.identity);
}
delete this.config.identity;
}
//Start ssh server connection
this.sshConnection = new Client();
this.sshConnection.on('ready', (err: Error & ClientErrorExtensions) => {
if (err) {
this.emit(SSHConstants.CHANNEL.SSH, SSHConstants.STATUS.DISCONNECT, { err: err });
this.__$connectPromise = null;
return reject(err);
}
this.emit(SSHConstants.CHANNEL.SSH, SSHConstants.STATUS.CONNECT);
this.__retries = 0;
this.__err = null;
resolve(this);
}).on('error', (err) => {
this.emit(SSHConstants.CHANNEL.SSH, SSHConstants.STATUS.DISCONNECT, { err: err });
this.__err = err;
}).on('close', () => {
this.emit(SSHConstants.CHANNEL.SSH, SSHConstants.STATUS.DISCONNECT, { err: this.__err });
if (this.config.reconnect && this.__retries <= this.config.reconnectTries! && this.__err && this.__err.level !== 'client-authentication' && this.__err.code !== 'ENOTFOUND') {
setTimeout(() => {
this.__$connectPromise = null;
resolve(this.connect());
}, this.config.reconnectDelay);
} else {
reject(this.__err);
}
}).connect(this.config);
});
return this.__$connectPromise;
}
/**
* Get existing tunnel by name
*/
getTunnel(name: string) {
return this.activeTunnels[name];
}
/**
* Add new tunnel if not exist
*/
addTunnel(SSHTunnelConfig: SSHTunnelConfig): Promise<SSHTunnelConfig & { server: Server }> {
SSHTunnelConfig.name = SSHTunnelConfig.name || `${SSHTunnelConfig.remoteAddr}@${SSHTunnelConfig.remotePort || SSHTunnelConfig.remoteSocketPath}`;
this.emit(SSHConstants.CHANNEL.TUNNEL, SSHConstants.STATUS.BEFORECONNECT, { SSHTunnelConfig: SSHTunnelConfig });
if (this.getTunnel(SSHTunnelConfig.name)) {
this.emit(SSHConstants.CHANNEL.TUNNEL, SSHConstants.STATUS.CONNECT, { SSHTunnelConfig: SSHTunnelConfig });
return Promise.resolve(this.getTunnel(SSHTunnelConfig.name));
} else {
return new Promise((resolve, reject) => {
let server: net.Server;
if (SSHTunnelConfig.socks) {
server = createSocksServer({
connectionFilter: (destination: SocksConnectionInfo, origin: SocksConnectionInfo, callback: (err?: any, dest?: stream.Duplex) => void) => {
this.connect().then(() => {
this.sshConnection!.forwardOut(
origin.address,
origin.port,
destination.address,
destination.port,
(err, stream) => {
if (err) {
this.emit(SSHConstants.CHANNEL.TUNNEL, SSHConstants.STATUS.DISCONNECT, { SSHTunnelConfig: SSHTunnelConfig, err: err });
return callback(err);
}
return callback(null, stream);
});
});
}
}).on('proxyError', (err: any) => {
this.emit(SSHConstants.CHANNEL.TUNNEL, SSHConstants.STATUS.DISCONNECT, { SSHTunnelConfig: SSHTunnelConfig, err: err });
});
} else {
server = net.createServer()
.on('connection', (socket) => {
this.connect().then(() => {
if (SSHTunnelConfig.remotePort) {
this.sshConnection!.forwardOut('127.0.0.1', 0, SSHTunnelConfig.remoteAddr!, SSHTunnelConfig.remotePort!, (err, stream) => {
if (err) {
this.emit(SSHConstants.CHANNEL.TUNNEL, SSHConstants.STATUS.DISCONNECT, { SSHTunnelConfig: SSHTunnelConfig, err: err });
return;
}
stream.pipe(socket);
socket.pipe(stream);
});
} else {
this.sshConnection!.openssh_forwardOutStreamLocal(SSHTunnelConfig.remoteSocketPath!, (err, stream) => {
if (err) {
this.emit(SSHConstants.CHANNEL.TUNNEL, SSHConstants.STATUS.DISCONNECT, { SSHTunnelConfig: SSHTunnelConfig, err: err });
return;
}
stream.pipe(socket);
socket.pipe(stream);
});
}
});
});
}
SSHTunnelConfig.localPort = SSHTunnelConfig.localPort || 0;
server.on('listening', () => {
SSHTunnelConfig.localPort = (server.address() as net.AddressInfo).port;
this.activeTunnels[SSHTunnelConfig.name!] = Object.assign({}, { server }, SSHTunnelConfig);
this.emit(SSHConstants.CHANNEL.TUNNEL, SSHConstants.STATUS.CONNECT, { SSHTunnelConfig: SSHTunnelConfig });
resolve(this.activeTunnels[SSHTunnelConfig.name!]);
}).on('error', (err: any) => {
this.emit(SSHConstants.CHANNEL.TUNNEL, SSHConstants.STATUS.DISCONNECT, { SSHTunnelConfig: SSHTunnelConfig, err: err });
server.close();
reject(err);
delete this.activeTunnels[SSHTunnelConfig.name!];
}).listen(SSHTunnelConfig.localPort);
});
}
}
/**
* Close the tunnel
*/
closeTunnel(name?: string): Promise<void> {
if (name && this.activeTunnels[name]) {
return new Promise((resolve) => {
const tunnel = this.activeTunnels[name];
this.emit(
SSHConstants.CHANNEL.TUNNEL,
SSHConstants.STATUS.BEFOREDISCONNECT,
{ SSHTunnelConfig: tunnel }
);
tunnel.server.close(() => {
this.emit(
SSHConstants.CHANNEL.TUNNEL,
SSHConstants.STATUS.DISCONNECT,
{ SSHTunnelConfig: this.activeTunnels[name] }
);
delete this.activeTunnels[name];
resolve();
});
});
} else if (!name) {
const tunnels = Object.keys(this.activeTunnels).map((key) => this.closeTunnel(key));
return Promise.all(tunnels).then(() => { });
}
return Promise.resolve();
}
}
@@ -0,0 +1,58 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export default class SSHDestination {
constructor(
public readonly hostname: string,
public readonly user?: string,
public readonly port?: number
) {
}
static parse(dest: string): SSHDestination {
let user: string | undefined;
const atPos = dest.lastIndexOf('@');
if (atPos !== -1) {
user = dest.substring(0, atPos);
}
let port: number | undefined;
const colonPos = dest.lastIndexOf(':');
if (colonPos !== -1) {
port = parseInt(dest.substring(colonPos + 1), 10);
}
const start = atPos !== -1 ? atPos + 1 : 0;
const end = colonPos !== -1 ? colonPos : dest.length;
const hostname = dest.substring(start, end);
return new SSHDestination(hostname, user, port);
}
toString(): string {
let result = this.hostname;
if (this.user) {
result = `${this.user}@` + result;
}
if (this.port) {
result = result + `:${this.port}`;
}
return result;
}
// vscode.uri implementation lowercases the authority, so when reopen or restore
// a remote session from the recently openend list the connection fails
static parseEncoded(dest: string): SSHDestination {
try {
const data = JSON.parse(Buffer.from(dest, 'hex').toString());
return new SSHDestination(data.hostName, data.user, data.port);
} catch {
}
return SSHDestination.parse(dest.replace(/\\x([0-9a-f]{2})/g, (_, charCode) => String.fromCharCode(parseInt(charCode, 16))));
}
toEncodedString(): string {
return this.toString().replace(/[A-Z]/g, (ch) => `\\x${ch.charCodeAt(0).toString(16).toLowerCase()}`);
}
}
+12
View File
@@ -0,0 +1,12 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "./out",
},
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.resolvers.d.ts",
"../../src/vscode-dts/vscode.proposed.contribViewsRemote.d.ts",
]
}
-56
View File
@@ -1,56 +0,0 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"plugins": [
"@typescript-eslint",
"react",
"react-hooks"
],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended"
],
"rules": {
"@typescript-eslint/naming-convention": [
"warn",
{
"selector": "import",
"format": [
"camelCase",
"PascalCase"
]
}
],
"curly": "off",
"eqeqeq": "warn",
"no-empty": "off",
"no-throw-literal": "warn",
"semi": "off",
"no-unused-vars": "off",
"react-hooks/exhaustive-deps": "warn"
},
"ignorePatterns": [
"out",
"dist",
"**/*.d.ts"
],
"settings": {
"react": {
"version": "detect"
}
},
"env": {
"browser": true, // enable browser globals linting (window, document, console, etc)
"es6": true, // enable ES6 linting
"node": true, // enable Node linting (things like Buffer which is used in file reading, etc)
"mocha": true // enable Mocha linting
}
}
-5
View File
@@ -1,5 +0,0 @@
out
dist
node_modules
.vscode-test/
*.vsix
-5
View File
@@ -1,5 +0,0 @@
import { defineConfig } from '@vscode/test-cli';
export default defineConfig({
files: 'out/test/**/*.test.js',
});
-8
View File
@@ -1,8 +0,0 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint",
"ms-vscode.extension-test-runner"
]
}
-21
View File
@@ -1,21 +0,0 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
-18
View File
@@ -1,18 +0,0 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/Thumbs.db": true,
"out": false,
"**/node_modules": true
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off",
}
-20
View File
@@ -1,20 +0,0 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
-11
View File
@@ -1,11 +0,0 @@
.vscode/**
.vscode-test/**
src/**
.gitignore
.yarnrc
vsc-extension-quickstart.md
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts
**/.vscode-test.*
-11
View File
@@ -1,11 +0,0 @@
Please see the `CONTRIBUTING.md` for information on how to contribute :)!
Here's an overview on how the extension works:
- The extension mounts in `extension.ts`.
- The Sidebar's HTML (everything in `sidebar/`) is built in React, and it's rendered by mounting a `<script>` tag - see `SidebarWebviewProvider.ts`.
- Communication between the sidebar script and the extension takes place via API. You can search for "postMessage" to see where API calls happen.
+3
View File
@@ -0,0 +1,3 @@
This folder is no longer relevant, since Void is no longer just an extension.
See the new Void code in `src/vs/workbench/contrib/void` (and a few other locations - you can just search "Void").
-19
View File
@@ -1,19 +0,0 @@
const tailwindcss = require('tailwindcss')
const autoprefixer = require('autoprefixer')
const postcss = require('postcss')
const fs = require('fs')
const from = 'src/sidebar/styles.css'
const to = 'dist/sidebar/styles.css'
const original_css_contents = fs.readFileSync(from, 'utf8')
postcss([
tailwindcss, // this compiles tailwind of all the files specified in tailwind.config.json
autoprefixer,
])
.process(original_css_contents, { from, to })
.then(processed_css_contents => { fs.writeFileSync(to, processed_css_contents.css) })
.catch(error => {
console.error('Error in build-css:', error)
})
-13
View File
@@ -1,13 +0,0 @@
const esbuild = require('esbuild')
// Build JS
esbuild.build({
entryPoints: ['src/sidebar/index.tsx'],
bundle: true,
minify: true,
sourcemap: true,
outfile: 'dist/sidebar/index.js',
format: 'iife', // apparently iife is safe for browsers (safer than cjs)
platform: 'browser',
external: ['vscode'],
}).catch(() => process.exit(1));
-9073
View File
File diff suppressed because it is too large Load Diff
-155
View File
@@ -1,155 +0,0 @@
{
"name": "void",
"publisher": "void",
"displayName": "Void",
"description": "",
"version": "0.0.1",
"engines": {
"vscode": "^1.92.0"
},
"categories": [
"Other"
],
"activationEvents": [],
"main": "./out/extension.js",
"contributes": {
"configuration": {
"title": "Void",
"properties": {}
},
"commands": [
{
"command": "void.ctrl+l",
"title": "Show Sidebar"
},
{
"command": "void.ctrl+k",
"title": "Make Inline Edit"
},
{
"command": "void.acceptDiff",
"title": "Approve Diff"
},
{
"command": "void.rejectDiff",
"title": "Discard Diff"
},
{
"command": "void.startNewThread",
"title": "Start a new chat",
"icon": "$(add)"
},
{
"command": "void.toggleThreadSelector",
"title": "View past chats",
"icon": "$(history)"
},
{
"command": "void.toggleSettings",
"title": "Void settings",
"icon": "$(settings-gear)"
}
],
"viewsContainers": {
"activitybar": [
{
"id": "voidViewContainer",
"title": "Chat",
"icon": "$(hubot)"
}
]
},
"views": {
"voidViewContainer": [
{
"type": "webview",
"id": "void.viewnumberone",
"name": "Void"
}
]
},
"keybindings": [
{
"command": "void.ctrl+l",
"key": "ctrl+l",
"mac": "cmd+l"
},
{
"command": "void.ctrl+k",
"key": "ctrl+k",
"mac": "cmd+k"
}
],
"menus": {
"view/title": [
{
"command": "void.startNewThread",
"when": "view == 'void.viewnumberone'",
"group": "navigation"
},
{
"command": "void.toggleThreadSelector",
"when": "view == 'void.viewnumberone'",
"group": "navigation"
},
{
"command": "void.toggleSettings",
"when": "view == 'void.viewnumberone'",
"group": "navigation"
}
]
}
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"build": "rimraf dist && node build-tsx.js && node build-css.js",
"pretest": "tsc -p ./ && eslint src --ext ts",
"test": "vscode-test"
},
"devDependencies": {
"@anthropic-ai/sdk": "^0.29.2",
"@eslint/js": "^9.9.1",
"@monaco-editor/react": "^4.6.0",
"@rrweb/types": "^2.0.0-alpha.17",
"@types/diff": "^5.2.2",
"@types/diff-match-patch": "^1.0.36",
"@types/jest": "^29.5.12",
"@types/lodash": "^4.17.12",
"@types/mocha": "^10.0.8",
"@types/node": "^22.5.1",
"@types/react": "^18.3.4",
"@types/react-dom": "^18.3.0",
"@types/react-syntax-highlighter": "^15.5.13",
"@types/uuid": "^10.0.0",
"@types/vscode": "1.92.0",
"@typescript-eslint/eslint-plugin": "^8.3.0",
"@typescript-eslint/parser": "^8.3.0",
"@vscode/test-cli": "^0.0.10",
"@vscode/test-electron": "2.4.1",
"autoprefixer": "^10.4.20",
"diff-match-patch": "^1.0.5",
"esbuild": "^0.23.1",
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.35.1",
"eslint-plugin-react-hooks": "^4.6.2",
"globals": "^15.9.0",
"lodash": "^4.17.21",
"marked": "^14.1.0",
"ollama": "^0.5.9",
"openai": "^4.68.4",
"postcss": "^8.4.41",
"posthog-js": "^1.176.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-markdown": "^9.0.1",
"react-syntax-highlighter": "^15.6.1",
"rimraf": "^6.0.1",
"rrweb-snapshot": "^2.0.0-alpha.4",
"tailwindcss": "^3.4.10",
"typescript": "5.5.4",
"typescript-eslint": "^8.3.0",
"uuid": "^10.0.0"
}
}
-560
View File
@@ -1,560 +0,0 @@
import * as vscode from 'vscode';
import { findDiffs } from './findDiffs';
import { Diff, DiffArea, BaseDiff, } from './common/shared_types';
import { readFileContentOfUri } from './common/readFileContentOfUri';
import { throttle } from 'lodash';
const THROTTLE_TIME = 100
// TODO in theory this should be disposed
const greenDecoration = vscode.window.createTextEditorDecorationType({
backgroundColor: 'rgba(0 255 51 / 0.2)',
isWholeLine: false, // after: { contentText: ' [original]', color: 'rgba(0 255 60 / 0.5)' } // hoverMessage: originalText // this applies to hovering over after:...
})
const lightGrayDecoration = vscode.window.createTextEditorDecorationType({
backgroundColor: 'rgba(218 218 218 / .2)',
isWholeLine: true,
})
const darkGrayDecoration = vscode.window.createTextEditorDecorationType({
backgroundColor: 'rgb(148 148 148 / .2)',
isWholeLine: true,
})
// responsible for displaying diffs and showing accept/reject buttons
export class DiffProvider implements vscode.CodeLensProvider {
private _originalFileOfDocument: { [docUriStr: string]: string } = {}
private _diffAreasOfDocument: { [docUriStr: string]: DiffArea[] } = {}
private _diffsOfDocument: { [docUriStr: string]: Diff[] } = {}
private _diffareaidPool = 0
private _diffidPool = 0
// used internally by vscode
private _onDidChangeCodeLenses: vscode.EventEmitter<void> = new vscode.EventEmitter<void>(); // signals a UI refresh on .fire() events
public readonly onDidChangeCodeLenses: vscode.Event<void> = this._onDidChangeCodeLenses.event;
// used internally by vscode
public provideCodeLenses(document: vscode.TextDocument, token: vscode.CancellationToken): vscode.ProviderResult<vscode.CodeLens[]> {
const docUriStr = document.uri.toString()
return this._diffsOfDocument[docUriStr]?.flatMap(diff => diff.lenses) ?? []
}
// declared by us, registered with vscode.languages.registerCodeLensProvider()
constructor() {
console.log('Creating DisplayChangesProvider')
// this acts as a useEffect every time text changes
vscode.workspace.onDidChangeTextDocument((e) => {
const editor = vscode.window.activeTextEditor
if (!editor) return
const docUriStr = editor.document.uri.toString()
const changes = e.contentChanges.map(c => ({ startLine: c.range.start.line, endLine: c.range.end.line, text: c.text, }))
// on user change, grow/shrink/merge/delete diff areas
this.refreshDiffAreasModel(docUriStr, changes, 'currentFile')
// refresh the diffAreas
this.refreshStylesAndDiffs(docUriStr)
})
}
// used by us only
public createDiffArea(uri: vscode.Uri, partialDiffArea: Omit<DiffArea, 'diffareaid'>, originalFile: string) {
const uriStr = uri.toString()
this._originalFileOfDocument[uriStr] = originalFile
// make sure array is defined
if (!this._diffAreasOfDocument[uriStr]) this._diffAreasOfDocument[uriStr] = []
// remove all diffAreas that the new `diffArea` is overlapping with
this._diffAreasOfDocument[uriStr] = this._diffAreasOfDocument[uriStr].filter(da => {
const noOverlap = da.startLine > partialDiffArea.endLine || da.endLine < partialDiffArea.startLine
if (!noOverlap) return false
return true
})
// add `diffArea` to storage
const diffArea = {
...partialDiffArea,
diffareaid: this._diffareaidPool
}
this._diffAreasOfDocument[uriStr].push(diffArea)
this._diffareaidPool += 1
return diffArea
}
// used by us only
// changes the start/line locations based on the changes that were recently made. does not change any of the diffs in the diff areas
// changes tells us how many lines were inserted/deleted so we can grow/shrink the diffAreas accordingly
public refreshDiffAreasModel(docUriStr: string, changes: { text: string, startLine: number, endLine: number }[], changesTo: 'originalFile' | 'currentFile') {
const diffAreas = this._diffAreasOfDocument[docUriStr] || []
let endName
let startName
if (changesTo === 'originalFile') {
endName = 'originalEndLine' as const
startName = 'originalStartLine' as const
} else {
endName = 'endLine' as const
startName = 'startLine' as const
}
for (const change of changes) {
// here, `change.range` is the range of the original file that gets replaced with `change.text`
// compute net number of newlines lines that were added/removed
const numNewLines = (change.text.match(/\n/g) || []).length
const numLineDeletions = change.endLine - change.startLine
const deltaNewlines = numNewLines - numLineDeletions
// compute overlap with each diffArea and shrink/elongate the diffArea accordingly
for (const diffArea of diffAreas) {
// if the change is fully within the diffArea, elongate it by the delta amount of newlines
if (change.startLine >= diffArea[startName] && change.endLine <= diffArea[endName]) {
diffArea[endName] += deltaNewlines
}
// check if the `diffArea` was fully deleted and remove it if so
if (diffArea[startName] > diffArea[endName]) {
//remove it
const index = diffAreas.findIndex(da => da === diffArea)
diffAreas.splice(index, 1)
}
// TODO handle other cases where eg. the change overlaps many diffAreas
}
// if a diffArea is below the last character of the change, shift the diffArea up/down by the delta amount of newlines
for (const diffArea of diffAreas) {
if (diffArea[startName] > change.endLine) {
diffArea[startName] += deltaNewlines
diffArea[endName] += deltaNewlines
}
}
// TODO merge any diffAreas if they overlap with each other as a result from the shift
}
}
// used by us only
// refreshes all the diffs inside each diff area, and refreshes the styles
public refreshStylesAndDiffs(docUriStr: string) {
const editor = vscode.window.activeTextEditor // TODO the editor should be that of `docUri` and not necessarily the current editor
if (!editor) {
console.log('Error: No active editor!')
return;
}
const originalFile = this._originalFileOfDocument[docUriStr]
if (!originalFile) {
console.log('Error: No original file!')
return;
}
const diffAreas = this._diffAreasOfDocument[docUriStr] || []
// reset all diffs (we update them below)
this._diffsOfDocument[docUriStr] = []
// for each diffArea
for (const diffArea of diffAreas) {
// get code inside of diffArea
const originalCode = originalFile.split('\n').slice(diffArea.originalStartLine, diffArea.originalEndLine + 1).join('\n')
const currentCode = editor.document.getText(new vscode.Range(diffArea.startLine, 0, diffArea.endLine, Number.MAX_SAFE_INTEGER)).replace(/\r\n/g, '\n')
// compute the diffs
const diffs = findDiffs(originalCode, currentCode)
// add the diffs to `this._diffsOfDocument[docUriStr]`
this.createDiffs(editor.document.uri, diffs, diffArea)
// // print diffs
// console.log('!ORIGINAL FILE:', JSON.stringify(originalFile))
// console.log('!NEW FILE :', JSON.stringify(editor.document.getText().replace(/\r\n/g, '\n')))
// console.log('!AREA originalCode:', JSON.stringify(originalCode))
// console.log('!AREA currentCode :', JSON.stringify(currentCode))
// for (const diff of this._diffsOfDocument[docUriStr]) {
// console.log('------------')
// console.log('originalCode:', JSON.stringify(diff.originalCode))
// console.log('currentCode:', JSON.stringify(diff.code))
// console.log('originalRange:', diff.originalRange.start.line, diff.originalRange.end.line,)
// console.log('currentRange:', diff.range.start.line, diff.range.end.line,)
// }
}
// update green highlighting
editor.setDecorations(
greenDecoration,
(this._diffsOfDocument[docUriStr]
.filter(diff => diff.range !== undefined)
.map(diff => diff.range)
)
);
// for each diffArea, highlight its sweepIndex in dark gray
editor.setDecorations(
darkGrayDecoration,
(this._diffAreasOfDocument[docUriStr]
.filter(diffArea => diffArea.sweepIndex !== null)
.map(diffArea => {
let s = diffArea.sweepIndex!
return new vscode.Range(s, 0, s, 0)
})
)
)
// for each diffArea, highlight sweepIndex+1...end in light gray
editor.setDecorations(
lightGrayDecoration,
(this._diffAreasOfDocument[docUriStr]
.filter(diffArea => diffArea.sweepIndex !== null)
.map(diffArea => {
return new vscode.Range(diffArea.sweepIndex! + 1, 0, diffArea.endLine, 0)
})
)
)
// TODO update red highlighting
// this._diffsOfDocument[docUriStr].map(diff => diff.deletedCode)
// update code lenses
this._onDidChangeCodeLenses.fire()
}
// used by us only
public createDiffs(docUri: vscode.Uri, diffs: BaseDiff[], diffArea: DiffArea) {
const docUriStr = docUri.toString()
// if no diffs, set diffs to []
if (!this._diffsOfDocument[docUriStr])
this._diffsOfDocument[docUriStr] = []
// add each diff and its codelens to the document
for (let i = diffs.length - 1; i > -1; i -= 1) {
let suggestedDiff = diffs[i]
this._diffsOfDocument[docUriStr].push({
...suggestedDiff,
diffid: this._diffidPool,
// originalCode: suggestedDiff.deletedText,
lenses: [
new vscode.CodeLens(suggestedDiff.range, { title: 'Accept', command: 'void.acceptDiff', arguments: [{ diffid: this._diffidPool, diffareaid: diffArea.diffareaid }] }),
new vscode.CodeLens(suggestedDiff.range, { title: 'Reject', command: 'void.rejectDiff', arguments: [{ diffid: this._diffidPool, diffareaid: diffArea.diffareaid }] })
]
});
this._diffidPool += 1
}
}
// called on void.acceptDiff
public async acceptDiff({ diffid, diffareaid }: { diffid: number, diffareaid: number }) {
const editor = vscode.window.activeTextEditor
if (!editor)
return
const docUriStr = editor.document.uri.toString()
const diffIdx = this._diffsOfDocument[docUriStr].findIndex(diff => diff.diffid === diffid);
if (diffIdx === -1) { console.error('Error: DiffID could not be found: ', diffid, diffareaid, this._diffsOfDocument[docUriStr], this._diffAreasOfDocument[docUriStr]); return; }
const diffareaIdx = this._diffAreasOfDocument[docUriStr].findIndex(diff => diff.diffareaid === diffareaid);
if (diffareaIdx === -1) { console.error('Error: DiffAreaID could not be found: ', diffid, diffareaid, this._diffsOfDocument[docUriStr], this._diffAreasOfDocument[docUriStr]); return; }
const diff = this._diffsOfDocument[docUriStr][diffIdx]
const originalFile = this._originalFileOfDocument[docUriStr]
const currentFile = await readFileContentOfUri(editor.document.uri)
// Fixed: Handle newlines properly by splitting into lines and joining with proper newlines
const originalLines = originalFile.split('\n');
const currentLines = currentFile.split('\n');
// Get the changed lines from current file
const changedLines = currentLines.slice(diff.range.start.line, diff.range.end.line + 1);
// Create new original file content by replacing the affected lines
const newOriginalLines = [
...originalLines.slice(0, diff.originalRange.start.line),
...changedLines,
...originalLines.slice(diff.originalRange.end.line + 1)
];
this._originalFileOfDocument[docUriStr] = newOriginalLines.join('\n');
// Update diff areas based on the change
this.refreshDiffAreasModel(docUriStr, [{
text: changedLines.join('\n'),
startLine: diff.originalRange.start.line,
endLine: diff.originalRange.end.line
}], 'originalFile')
// Check if diffArea should be removed
const diffArea = this._diffAreasOfDocument[docUriStr][diffareaIdx]
const currentArea = currentLines.slice(diffArea.startLine, diffArea.endLine + 1).join('\n')
const originalArea = newOriginalLines.slice(diffArea.originalStartLine, diffArea.originalEndLine + 1).join('\n')
console.log('ACCEPT change', changedLines.join('\n'), diff.originalRange.start.line, diff.originalRange.end.line)
console.log('ACCEPT area lines', diffArea.startLine, diffArea.endLine, diffArea.originalStartLine, diffArea.originalEndLine)
console.log('ACCEPT currentArea', currentArea)
console.log('ACCEPT originalArea', originalArea)
if (originalArea === currentArea) {
const index = this._diffAreasOfDocument[docUriStr].findIndex(da => da.diffareaid === diffArea.diffareaid)
this._diffAreasOfDocument[docUriStr].splice(index, 1)
}
this.refreshStylesAndDiffs(docUriStr)
}
// called on void.rejectDiff
public async rejectDiff({ diffid, diffareaid }: { diffid: number, diffareaid: number }) {
const editor = vscode.window.activeTextEditor
if (!editor)
return
const docUriStr = editor.document.uri.toString()
const diffIdx = this._diffsOfDocument[docUriStr].findIndex(diff => diff.diffid === diffid);
if (diffIdx === -1) { console.error('Error: DiffID could not be found: ', diffid, diffareaid, this._diffsOfDocument[docUriStr], this._diffAreasOfDocument[docUriStr]); return; }
const diffareaIdx = this._diffAreasOfDocument[docUriStr].findIndex(diff => diff.diffareaid === diffareaid);
if (diffareaIdx === -1) { console.error('Error: DiffAreaID could not be found: ', diffid, diffareaid, this._diffsOfDocument[docUriStr], this._diffAreasOfDocument[docUriStr]); return; }
const diff = this._diffsOfDocument[docUriStr][diffIdx]
// Apply the rejection by replacing with original code
// we don't have to edit the original or final file; just do a workspace edit so the code equals the original code
const workspaceEdit = new vscode.WorkspaceEdit();
workspaceEdit.replace(editor.document.uri, diff.range, diff.originalCode)
await vscode.workspace.applyEdit(workspaceEdit)
// Check if diffArea should be removed
const originalFile = this._originalFileOfDocument[docUriStr]
const currentFile = await readFileContentOfUri(editor.document.uri)
const diffArea = this._diffAreasOfDocument[docUriStr][diffareaIdx]
const currentLines = currentFile.split('\n');
const originalLines = originalFile.split('\n');
const currentArea = currentLines.slice(diffArea.startLine, diffArea.endLine + 1).join('\n')
const originalArea = originalLines.slice(diffArea.originalStartLine, diffArea.originalEndLine + 1).join('\n')
console.log('REJECT diff lines', diff.originalRange.start.line, diff.originalRange.end.line)
console.log('REJECT area lines', diffArea.startLine, diffArea.endLine, diffArea.originalStartLine, diffArea.originalEndLine)
console.log('REJECT currentArea', currentArea)
console.log('REJECT originalArea', originalArea)
if (originalArea === currentArea) {
const index = this._diffAreasOfDocument[docUriStr].findIndex(da => da.diffareaid === diffArea.diffareaid)
this._diffAreasOfDocument[docUriStr].splice(index, 1)
}
this.refreshStylesAndDiffs(docUriStr)
}
// used by us only
public updateStream = throttle(async (docUriStr: string, diffArea: DiffArea, newDiffAreaCode: string) => {
const editor = vscode.window.activeTextEditor // TODO the editor should be that of `docUri` and not necessarily the current editor
if (!editor) {
console.log('Error: No active editor!')
return;
}
// original code all diffs are based on in the code
const originalDiffAreaCode = (this._originalFileOfDocument[docUriStr] || '').split('\n').slice(diffArea.originalStartLine, diffArea.originalEndLine + 1).join('\n')
// figure out where to highlight based on where the AI is in the stream right now, use the last diff in findDiffs to figure that out
const diffs = findDiffs(originalDiffAreaCode, newDiffAreaCode)
const lastDiff = diffs[diffs.length - 1] ?? null
// these are two different coordinate systems - new and old line number
let newFileEndLine: number // get new[0...newStoppingPoint] with line=newStoppingPoint highlighted
let oldFileStartLine: number // get original[oldStartingPoint...]
if (!lastDiff) {
// if the writing is identical so far, display no changes
newFileEndLine = 0
oldFileStartLine = 0
}
else {
if (lastDiff.type === 'insertion') {
newFileEndLine = lastDiff.range.end.line
oldFileStartLine = lastDiff.originalRange.start.line
}
else if (lastDiff.type === 'deletion') {
newFileEndLine = lastDiff.range.start.line
oldFileStartLine = lastDiff.originalRange.start.line
}
else if (lastDiff.type === 'edit') {
newFileEndLine = lastDiff.range.end.line
oldFileStartLine = lastDiff.originalRange.start.line
}
else {
throw new Error(`updateStream: diff.type not recognized: ${lastDiff.type}`)
}
}
// display
const newFileTop = newDiffAreaCode.split('\n').slice(0, newFileEndLine + 1).join('\n')
const oldFileBottom = originalDiffAreaCode.split('\n').slice(oldFileStartLine + 1, Infinity).join('\n')
let newCode = `${newFileTop}\n${oldFileBottom}`
diffArea.sweepIndex = newFileEndLine
// replace oldDACode with newDACode with a vscode edit
const workspaceEdit = new vscode.WorkspaceEdit();
const diffareaRange = new vscode.Range(diffArea.startLine, 0, diffArea.endLine, Number.MAX_SAFE_INTEGER)
workspaceEdit.replace(editor.document.uri, diffareaRange, newCode)
await vscode.workspace.applyEdit(workspaceEdit)
}, THROTTLE_TIME)
}
/*
import * as vscode from 'vscode';
import { SuggestedEdit } from './findDiffs';
const greenDecoration = vscode.window.createTextEditorDecorationType({
backgroundColor: 'rgba(0 255 51 / 0.2)',
isWholeLine: false, // after: { contentText: ' [original]', color: 'rgba(0 255 60 / 0.5)' } // hoverMessage: originalText // this applies to hovering over after:...
})
export class DiffProvider {
originalCodeOfDocument: { [docUri: string]: string }
diffsOfDocument: {
[docUri: string]: {
startLine,
startCol,
endLine,
endCol,
originalText,
inset,
diffid,
}
}
// sweep
currentLine: { [docUri: string]: undefined | number }
weAreEditing: boolean = false
constructor() {
vscode.workspace.onDidChangeTextDocument((e) => {
// on user change, grow/shrink/merge/delete diff AREAS
// you dont have to do anything to the diffs here bc they all get recomputed in refresh()
// user changes only get highlighted if theyre in a diffarea
// go thru all diff areas and adjust line numbers based on the user's change
this.refreshStyles(e.document.uri.toString())
})
}
// refreshes styles on page
refreshStyles(docUriStr: string) {
if (this.weAreEditing) return
// recompute all diffs on the page
// run inset.dispose() on all diffs
// original and current code -> diffs
// originalCodeOfDocument[docUriStr]
// create new diffs
const inset = vscode.window.createWebviewTextEditorInset(editor, lineStart, height, {})
inset.webview.html = `
<html>
<body style="pointer-events:none;">Hello World!</body>
</html>
`;
}
// called on void.acceptDiff
public async acceptDiff({ diffid }: { diffid: number }) {
// update original based on the diff
// refresh()
}
// called on void.rejectDiff
public async rejectDiff({ diffid }: { diffid: number }) {
// get diffs[diffid]
// revert current file based on diff
// refresh()
}
// sweep
initializeSweep({ startLine }) {
// reject all diffs on the page
// store original code
// currentLine=start of sweep
}
onUpdateSweep(addedText) {
// update final
// refresh() ?
// currentLine += number of newlines in addedText
}
onAbortSweep() {
}
}
*/
@@ -1,85 +0,0 @@
// renders the code from `src/sidebar`
import * as vscode from 'vscode';
function generateNonce() {
let text = "";
const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (let i = 0; i < 32; i++) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
return text;
}
export class SidebarWebviewProvider implements vscode.WebviewViewProvider {
public static readonly viewId = 'void.viewnumberone';
public webview: Promise<vscode.Webview> // used to send messages to the webview, resolved by _res in resolveWebviewView
private _res: (c: vscode.Webview) => void // used to resolve the webview
private readonly _extensionUri: vscode.Uri
// private _webviewView?: vscode.WebviewView;
private _webviewDeps: string[] = [];
constructor(context: vscode.ExtensionContext) {
// const extensionPath = context.extensionPath // the directory where the extension is installed, might be useful later... was included in webviewProvider code
this._extensionUri = context.extensionUri
let temp_res: typeof this._res | undefined = undefined
this.webview = new Promise((res, rej) => { temp_res = res })
if (!temp_res) throw new Error("Void sidebar provider: resolver was undefined")
this._res = temp_res
}
// called by us
updateWebviewHTML(webview: vscode.Webview) {
this._webviewDeps = []
const scriptUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'dist/sidebar/index.js'));
const stylesUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'dist/sidebar/styles.css'));
const rootUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri));
const nonce = generateNonce();
const webviewHTML = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Custom View</title>
<meta http-equiv="Content-Security-Policy" content="img-src vscode-resource: https:; script-src 'nonce-${nonce}'; style-src vscode-resource: 'unsafe-inline' http: https: data:;">
<base href="${rootUri}/">
<link href="${stylesUri}" rel="stylesheet">
</head>
<body>
<div id="root"></div>
<div id="ctrlkroot"></div>
<script nonce="${nonce}" src="${scriptUri}"></script>
</body>
</html>`;
webview.html = webviewHTML;
}
// called internally by vscode
resolveWebviewView(
webviewView: vscode.WebviewView,
context: vscode.WebviewViewResolveContext,
token: vscode.CancellationToken,
) {
const webview = webviewView.webview;
webview.options = {
enableScripts: true,
localResourceRoots: [this._extensionUri]
};
this.updateWebviewHTML(webview);
// resolve webview and _webviewView
this._res(webview);
// this._webviewView = webviewView;
}
}
-101
View File
@@ -1,101 +0,0 @@
import * as vscode from 'vscode';
import { AbortRef, OnFinalMessage, OnText, sendLLMMessage } from "./sendLLMMessage"
import { VoidConfig } from '../sidebar/contextForConfig';
import { findDiffs } from '../findDiffs';
import { searchDiffChunkInstructions, writeFileWithDiffInstructions } from './systemPrompts';
import { throttle } from 'lodash';
import { readFileContentOfUri } from './readFileContentOfUri';
type Res<T> = ((value: T) => void)
const THRTOTLE_TIME = 100 // minimum time between edits
const LINES_PER_CHUNK = 20 // number of lines to search at a time
const applyCtrlLChangesToFile = throttle(
({ fileUri, newCurrentLine, oldCurrentLine, fullCompletedStr, oldFileStr, debug }: { fileUri: vscode.Uri, newCurrentLine: number, oldCurrentLine: number, fullCompletedStr: string, oldFileStr: string, debug?: string }) => {
// write the change to the file
const WRITE_TO_FILE = (
fullCompletedStr.split('\n').slice(0, newCurrentLine + 1).join('\n') // newFile[:newCurrentLine+1]
+ oldFileStr.split('\n').slice(oldCurrentLine + 1).join('\n') // oldFile[oldCurrentLine+1:]
)
const workspaceEdit = new vscode.WorkspaceEdit()
workspaceEdit.replace(fileUri, new vscode.Range(0, 0, Number.MAX_SAFE_INTEGER, 0), WRITE_TO_FILE)
vscode.workspace.applyEdit(workspaceEdit)
// highlight the `newCurrentLine` in white
// highlight the remaining part of the file in gray
},
THRTOTLE_TIME, { trailing: true }
)
const applyCtrlK = async ({ fileUri, startLine, endLine, instructions, voidConfig, abortRef }: { fileUri: vscode.Uri, startLine: number, endLine: number, instructions: string, voidConfig: VoidConfig, abortRef: AbortRef }) => {
const fileStr = await readFileContentOfUri(fileUri)
const fileLines = fileStr.split('\n')
const prefix = fileLines.slice(startLine).join('\n')
const suffix = fileLines.slice(endLine + 1).join('\n')
const selection = fileLines.slice(startLine, endLine + 1).join('\n')
const promptContent = `Here is the user's original selection:
\`\`\`
<MID>${selection}</MID>
\`\`\`
The user wants to apply the following instructions to the selection:
${instructions}
Please rewrite the selection following the user's instructions.
Instructions to follow:
1. Follow the user's instructions
2. You may ONLY CHANGE the selection, and nothing else in the file
3. Make sure all brackets in the new selection are balanced the same was as in the original selection
3. Be careful not to duplicate or remove variables, comments, or other syntax by mistake
Complete the following:
\`\`\`
<PRE>${prefix}</PRE>
<SUF>${suffix}</SUF>
<MID>`;
// TODO initialize stream
// update stream
sendLLMMessage({
messages: [{ role: 'user', content: promptContent, }],
onText: async (tokenStr, completionStr) => {
// TODO update stream
// apply the changes
const newCode = `${prefix}\n${completionStr}\n${suffix}`
const workspaceEdit = new vscode.WorkspaceEdit()
workspaceEdit.replace(fileUri, new vscode.Range(0, 0, Number.MAX_SAFE_INTEGER, 0), newCode)
vscode.workspace.applyEdit(workspaceEdit)
},
onFinalMessage: (completionStr) => {
// TODO end stream
// apply the changes
const newCode = `${prefix}\n${completionStr}\n${suffix}`
const workspaceEdit = new vscode.WorkspaceEdit()
workspaceEdit.replace(fileUri, new vscode.Range(0, 0, Number.MAX_SAFE_INTEGER, 0), newCode)
vscode.workspace.applyEdit(workspaceEdit)
},
onError: (e) => {
console.error('Error rewriting file with diff', e);
},
voidConfig,
abortRef,
})
}
export { applyCtrlK }
-191
View File
@@ -1,191 +0,0 @@
import * as vscode from 'vscode';
import { AbortRef, OnFinalMessage, OnText, sendLLMMessage } from "./sendLLMMessage"
import { VoidConfig } from '../sidebar/contextForConfig';
import { findDiffs } from '../findDiffs';
import { searchDiffChunkInstructions, writeFileWithDiffInstructions } from './systemPrompts';
import { throttle } from 'lodash';
import { readFileContentOfUri } from './readFileContentOfUri';
import { DiffProvider } from '../DiffProvider';
import { DiffArea } from './shared_types';
const LINES_PER_CHUNK = 20 // number of lines to search at a time
// const THRTOTLE_TIME = 100 // minimum time between edits
// throttle(
// THRTOTLE_TIME, { trailing: true }
// )
type CompetedReturn = { isFinished: true, } | { isFinished?: undefined, }
const streamChunk = ({ diffProvider, docUri, oldFileStr, completedStr, diffRepr, diffArea, voidConfig, abortRef }: { diffProvider: DiffProvider, docUri: vscode.Uri, oldFileStr: string, completedStr: string, diffRepr: string, voidConfig: VoidConfig, diffArea: DiffArea, abortRef: AbortRef }) => {
const NUM_MATCHUP_TOKENS = 20
const promptContent = `ORIGINAL_FILE
\`\`\`
${oldFileStr}
\`\`\`
DIFF
\`\`\`
${diffRepr}
\`\`\`
INSTRUCTIONS
Please finish writing the new file \`NEW_FILE\`. Return ONLY the completion of the file, without any explanation.
NEW_FILE
\`\`\`
${completedStr}
\`\`\`
`
// create a promise that can be awaited
return new Promise<CompetedReturn>((resolve, reject) => {
let isAnyChangeSoFar = false
// make LLM complete the file to include the diff
sendLLMMessage({
messages: [{ role: 'system', content: writeFileWithDiffInstructions, }, { role: 'user', content: promptContent, }],
onText: (newText, fullText) => {
const fullCompletedStr = completedStr + fullText
diffProvider.updateStream(docUri.toString(), diffArea, fullCompletedStr)
// if there was any change from the original file
if (!oldFileStr.includes(fullCompletedStr)) {
isAnyChangeSoFar = true
}
const isRecentMatchup = false
// the final NUM_MATCHUP_TOKENS characters of fullCompletedStr are the same as the final NUM_MATCHUP_TOKENS characters of the last item in the diffs of oldFileStr that had 0 changes
if (isAnyChangeSoFar && isRecentMatchup) {
diffProvider.updateStream(docUri.toString(), diffArea, fullCompletedStr)
// TODO resolve the promise
// resolve({ speculativeIndex: newCurrentLine + 1 });
// abort the LLM call
abortRef.current?.()
}
},
onFinalMessage: (fullText) => {
const newCompletedStr = completedStr + fullText
diffProvider.updateStream(docUri.toString(), diffArea, newCompletedStr)
resolve({ isFinished: true });
},
onError: (e) => {
resolve({ isFinished: true });
console.error('Error rewriting file with diff', e);
},
voidConfig,
abortRef,
})
})
}
const shouldApplyDiff = ({ diffRepr, oldFileStr: fileStr, speculationStr, voidConfig, abortRef }: { diffRepr: string, oldFileStr: string, speculationStr: string, voidConfig: VoidConfig, abortRef: AbortRef }) => {
const promptContent = `DIFF
\`\`\`
${diffRepr}
\`\`\`
FILES
\`\`\`
${fileStr}
\`\`\`
SELECTION
\`\`\`
${speculationStr}
\`\`\`
Return \`true\` if ANY part of the chunk should be modified, and \`false\` if it should not be modified. You should respond only with \`true\` or \`false\` and nothing else.
`
// create new promise
return new Promise<boolean>((resolve, reject) => {
// send message to LLM
sendLLMMessage({
messages: [{ role: 'system', content: searchDiffChunkInstructions, }, { role: 'user', content: promptContent, }],
onFinalMessage: (finalMessage) => {
const containsTrue = finalMessage
.slice(-10) // check for `true` in last 10 characters
.toLowerCase()
.includes('true')
resolve(containsTrue)
},
onError: (e) => {
resolve(false);
console.error('Error in shouldApplyDiff: ', e)
},
onText: () => { },
voidConfig,
abortRef,
})
})
}
// lazily applies the diff to the file
// we chunk the text in the file, and ask an LLM whether it should edit each chunk
const applyDiffLazily = async ({ docUri, oldFileStr, voidConfig, abortRef, diffRepr, diffProvider, diffArea }: { docUri: vscode.Uri, oldFileStr: string, diffRepr: string, voidConfig: VoidConfig, diffProvider: DiffProvider, diffArea: DiffArea, abortRef: AbortRef }) => {
// stateful variables
let speculativeIndex = 0
let writtenTextSoFar: string[] = []
while (speculativeIndex < oldFileStr.split('\n').length) {
const chunkStr = oldFileStr.split('\n').slice(speculativeIndex, speculativeIndex + LINES_PER_CHUNK).join('\n')
// ask LLM if we should apply the diff to the chunk
const START = new Date().getTime()
let shouldApplyDiff_ = await shouldApplyDiff({ oldFileStr, speculationStr: chunkStr, diffRepr, voidConfig, abortRef })
const END = new Date().getTime()
// if should not change the chunk
if (!shouldApplyDiff_) {
console.log('KEEP CHUNK time: ', END - START)
speculativeIndex += LINES_PER_CHUNK
writtenTextSoFar.push(chunkStr)
diffProvider.updateStream(docUri.toString(), diffArea, writtenTextSoFar.join('\n'))
continue;
}
// ask LLM to rewrite file with diff (if there is significant matchup with the original file, we stop rewriting)
const START2 = new Date().getTime()
const completedStr = (await readFileContentOfUri(docUri)).split('\n').slice(0, speculativeIndex).join('\n');
const result = await streamChunk({ diffProvider, docUri, oldFileStr, completedStr, diffRepr, voidConfig, diffArea, abortRef, })
const END2 = new Date().getTime()
console.log('EDIT CHUNK time: ', END2 - START2);
// if we are finished, stop the loop
if (result.isFinished) {
break;
}
// TODO
// speculativeIndex = result.speculativeIndex
}
}
export { applyDiffLazily }
@@ -1,14 +0,0 @@
import * as vscode from 'vscode'
export const readFileContentOfUri = async (uri: vscode.Uri): Promise<string> => {
const document = await vscode.workspace.openTextDocument(uri);
return document.getText().replace(/\r\n/g, '\n') ?? '' // Normalize line endings
};
// this is the old version, which only reads the most recently saved version
// export const readFileContentOfUri = async (uri: vscode.Uri) => {
// return Buffer.from(await vscode.workspace.fs.readFile(uri)).toString('utf8')
// .replace(/\r\n/g, '\n') // replace windows \r\n with \n
// }
@@ -1,307 +0,0 @@
import Anthropic from '@anthropic-ai/sdk';
import OpenAI from 'openai';
import { Ollama } from 'ollama/browser'
import { VoidConfig } from '../sidebar/contextForConfig';
export type AbortRef = { current: (() => void) | null }
export type OnText = (newText: string, fullText: string) => void
export type OnFinalMessage = (input: string) => void
export type LLMMessageAnthropic = {
role: 'user' | 'assistant',
content: string,
}
export type LLMMessage = {
role: 'system' | 'user' | 'assistant',
content: string,
}
type SendLLMMessageFnTypeInternal = (params: {
messages: LLMMessage[],
onText: OnText,
onFinalMessage: OnFinalMessage,
onError: (error: string) => void,
voidConfig: VoidConfig,
abortRef: AbortRef,
}) => void
type SendLLMMessageFnTypeExternal = (params: {
messages: LLMMessage[],
onText: OnText,
onFinalMessage: (fullText: string) => void,
onError: (error: string) => void,
voidConfig: VoidConfig | null,
abortRef: AbortRef,
}) => void
// Anthropic
const sendAnthropicMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFinalMessage, onError, voidConfig }) => {
const anthropic = new Anthropic({ apiKey: voidConfig.anthropic.apikey, dangerouslyAllowBrowser: true }); // defaults to process.env["ANTHROPIC_API_KEY"]
// find system messages and concatenate them
const systemMessage = messages
.filter(msg => msg.role === 'system')
.map(msg => msg.content)
.join('\n');
// remove system messages for Anthropic
const anthropicMessages = messages.filter(msg => msg.role !== 'system') as LLMMessageAnthropic[]
const stream = anthropic.messages.stream({
system: systemMessage,
messages: anthropicMessages,
model: voidConfig.anthropic.model,
max_tokens: parseInt(voidConfig.default.maxTokens),
});
let did_abort = false
// when receive text
stream.on('text', (newText, fullText) => {
if (did_abort) return
onText(newText, fullText)
})
// when we get the final message on this stream (or when error/fail)
stream.on('finalMessage', (claude_response) => {
if (did_abort) return
// stringify the response's content
let content = claude_response.content.map(c => { if (c.type === 'text') { return c.text } }).join('\n');
onFinalMessage(content)
})
stream.on('error', (error) => {
// the most common error will be invalid API key (401), so we handle this with a nice message
if (error instanceof Anthropic.APIError && error.status === 401) {
onError('Invalid API key.')
}
else {
onError(error.message)
}
})
// if abort is called, onFinalMessage is NOT called, and no later onTexts are called either
const abort = () => {
did_abort = true
stream.controller.abort() // TODO need to test this to make sure it works, it might throw an error
}
return { abort }
};
// OpenAI, OpenRouter, OpenAICompatible
const sendOpenAIMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFinalMessage, onError, voidConfig, abortRef }) => {
let didAbort = false
let fullText = ''
// if abort is called, onFinalMessage is NOT called, and no later onTexts are called either
abortRef.current = () => {
didAbort = true;
};
let openai: OpenAI
let options: OpenAI.Chat.Completions.ChatCompletionCreateParamsStreaming
if (voidConfig.default.whichApi === 'openAI') {
openai = new OpenAI({ apiKey: voidConfig.openAI.apikey, dangerouslyAllowBrowser: true });
options = { model: voidConfig.openAI.model, messages: messages, stream: true, max_completion_tokens: parseInt(voidConfig.default.maxTokens) }
}
else if (voidConfig.default.whichApi === 'openRouter') {
openai = new OpenAI({
baseURL: "https://openrouter.ai/api/v1", apiKey: voidConfig.openRouter.apikey, dangerouslyAllowBrowser: true,
defaultHeaders: {
"HTTP-Referer": 'https://voideditor.com', // Optional, for including your app on openrouter.ai rankings.
"X-Title": 'Void Editor', // Optional. Shows in rankings on openrouter.ai.
},
});
options = { model: voidConfig.openRouter.model, messages: messages, stream: true, max_completion_tokens: parseInt(voidConfig.default.maxTokens) }
}
else if (voidConfig.default.whichApi === 'openAICompatible') {
openai = new OpenAI({ baseURL: voidConfig.openAICompatible.endpoint, apiKey: voidConfig.openAICompatible.apikey, dangerouslyAllowBrowser: true })
options = { model: voidConfig.openAICompatible.model, messages: messages, stream: true, max_completion_tokens: parseInt(voidConfig.default.maxTokens) }
}
else {
console.error(`sendOpenAIMsg: invalid whichApi: ${voidConfig.default.whichApi}`)
throw new Error(`voidConfig.whichAPI was invalid: ${voidConfig.default.whichApi}`)
}
openai.chat.completions
.create(options)
.then(async response => {
abortRef.current = () => {
// response.controller.abort()
didAbort = true;
}
// when receive text
for await (const chunk of response) {
if (didAbort) return;
const newText = chunk.choices[0]?.delta?.content || '';
fullText += newText;
onText(newText, fullText);
}
onFinalMessage(fullText);
})
// when error/fail - this catches errors of both .create() and .then(for await)
.catch(error => {
if (error instanceof OpenAI.APIError) {
if (error.status === 401) {
onError('Invalid API key.');
}
else {
onError(error.message);
}
}
else {
onError(error);
}
})
};
// Ollama
export const sendOllamaMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFinalMessage, onError, voidConfig, abortRef }) => {
let didAbort = false
let fullText = ""
// if abort is called, onFinalMessage is NOT called, and no later onTexts are called either
abortRef.current = () => {
didAbort = true;
};
const ollama = new Ollama({ host: voidConfig.ollama.endpoint })
ollama.chat({
model: voidConfig.ollama.model,
messages: messages,
stream: true,
options: { num_predict: parseInt(voidConfig.default.maxTokens) } // this is max_tokens
})
.then(async stream => {
abortRef.current = () => {
// stream.abort()
didAbort = true
}
// iterate through the stream
for await (const chunk of stream) {
if (didAbort) return;
const newText = chunk.message.content;
fullText += newText;
onText(newText, fullText);
}
onFinalMessage(fullText);
})
// when error/fail
.catch(error => {
onError(error)
})
};
// Greptile
// https://docs.greptile.com/api-reference/query
// https://docs.greptile.com/quickstart#sample-response-streamed
const sendGreptileMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFinalMessage, onError, voidConfig, abortRef }) => {
let didAbort = false
let fullText = ''
// if abort is called, onFinalMessage is NOT called, and no later onTexts are called either
abortRef.current = () => {
didAbort = true
}
fetch('https://api.greptile.com/v2/query', {
method: 'POST',
headers: {
"Authorization": `Bearer ${voidConfig.greptile.apikey}`,
"X-Github-Token": `${voidConfig.greptile.githubPAT}`,
"Content-Type": `application/json`,
},
body: JSON.stringify({
messages,
stream: true,
repositories: [voidConfig.greptile.repoinfo],
}),
})
// this is {message}\n{message}\n{message}...\n
.then(async response => {
const text = await response.text()
console.log('got greptile', text)
return JSON.parse(`[${text.trim().split('\n').join(',')}]`)
})
// TODO make this actually stream, right now it just sends one message at the end
.then(async responseArr => {
if (didAbort)
return
for (let response of responseArr) {
const type: string = response['type']
const message = response['message']
// when receive text
if (type === 'message') {
fullText += message
onText(message, fullText)
}
else if (type === 'sources') {
const { filepath, linestart, lineend } = message as { filepath: string, linestart: number | null, lineend: number | null }
fullText += filepath
onText(filepath, fullText)
}
// type: 'status' with an empty 'message' means last message
else if (type === 'status') {
if (!message) {
onFinalMessage(fullText)
}
}
}
})
.catch(e => {
onError(e)
});
}
export const sendLLMMessage: SendLLMMessageFnTypeExternal = ({ messages, onText, onFinalMessage, onError, voidConfig, abortRef }) => {
if (!voidConfig) return;
// trim message content (Anthropic and other providers give an error if there is trailing whitespace)
messages = messages.map(m => ({ ...m, content: m.content.trim() }))
switch (voidConfig.default.whichApi) {
case 'anthropic':
return sendAnthropicMsg({ messages, onText, onFinalMessage, onError, voidConfig, abortRef });
case 'openAI':
case 'openRouter':
case 'openAICompatible':
return sendOpenAIMsg({ messages, onText, onFinalMessage, onError, voidConfig, abortRef });
case 'ollama':
return sendOllamaMsg({ messages, onText, onFinalMessage, onError, voidConfig, abortRef });
case 'greptile':
return sendGreptileMsg({ messages, onText, onFinalMessage, onError, voidConfig, abortRef });
default:
onError(`Error: whichApi was ${voidConfig.default.whichApi}, which is not recognized!`)
}
}
-100
View File
@@ -1,100 +0,0 @@
import * as vscode from 'vscode';
import { PartialVoidConfig } from '../sidebar/contextForConfig';
// a selection is a frozen snapshot
type CodeSelection = { selectionStr: string, selectionRange: vscode.Range, filePath: vscode.Uri }
type File = { filepath: vscode.Uri, content: string }
// an area that is currently being diffed
type DiffArea = {
diffareaid: number,
startLine: number,
endLine: number,
originalStartLine: number,
originalEndLine: number,
sweepIndex: number | null // null iff not sweeping
}
// the return type of diff creator
type BaseDiff = {
type: 'edit' | 'insertion' | 'deletion';
// repr: string; // representation of the diff in text
originalRange: vscode.Range;
originalCode: string;
range: vscode.Range;
code: string;
}
// each diff on the user's screen
type Diff = {
diffid: number,
lenses: vscode.CodeLens[],
} & BaseDiff
// editor -> sidebar
type MessageToSidebar = (
| { type: 'ctrl+l', selection: CodeSelection } // user presses ctrl+l in the editor
| { type: 'ctrl+k', selection: CodeSelection }
| { type: 'files', files: { filepath: vscode.Uri, content: string }[] }
| { type: 'partialVoidConfig', partialVoidConfig: PartialVoidConfig }
| { type: 'allThreads', threads: ChatThreads }
| { type: 'startNewThread' }
| { type: 'toggleThreadSelector' }
| { type: 'toggleSettings' }
| { type: 'deviceId', deviceId: string }
)
// sidebar -> editor
type MessageFromSidebar = (
| { type: 'applyChanges', diffRepr: string } // user clicks "apply" in the sidebar
| { type: 'requestFiles', filepaths: vscode.Uri[] }
| { type: 'getPartialVoidConfig' }
| { type: 'persistPartialVoidConfig', partialVoidConfig: PartialVoidConfig }
| { type: 'getAllThreads' }
| { type: 'persistThread', thread: ChatThreads[string] }
| { type: 'getDeviceId' }
)
type ChatThreads = {
[id: string]: {
id: string; // store the id here too
createdAt: string; // ISO string
lastModified: string; // ISO string
messages: ChatMessage[];
}
}
type ChatMessage =
| {
role: "user";
content: string; // content sent to the llm
displayContent: string; // content displayed to user
selection: CodeSelection | null; // the user's selection
files: vscode.Uri[]; // the files sent in the message
}
| {
role: "assistant";
content: string; // content received from LLM
displayContent: string | undefined; // content displayed to user (this is the same as content for now)
}
| {
role: "system";
content: string;
displayContent?: undefined;
}
export {
BaseDiff, Diff,
DiffArea,
CodeSelection,
File,
MessageFromSidebar,
MessageToSidebar,
ChatThreads,
ChatMessage,
}
-406
View File
@@ -1,406 +0,0 @@
const generateDiffInstructions = `
You are a coding assistant. You are given a list of relevant files \`files\`, a selection that the user is making \`selection\`, and instructions to follow \`instructions\`.
Please edit the selected file following the user's instructions (or, if appropriate, answer their question instead).
All changes made to files must be outputted in unified diff format.
Unified diff format instructions:
1. Each diff must begin with \`\`\`@@ ... @@\`\`\`.
2. Each line must start with a \`+\` or \`-\` or \` \` symbol.
3. Make diffs more than a few lines.
4. Make high-level diffs rather than many one-line diffs.
Here's an example of unified diff format:
\`\`\`
@@ ... @@
-def factorial(n):
- if n == 0:
- return 1
- else:
- return n * factorial(n-1)
+def factorial(number):
+ if number == 0:
+ return 1
+ else:
+ return number * factorial(number-1)
\`\`\`
Please create high-level diffs where you group edits together if they are near each other, like in the above example. Another way to represent the above example is to make many small line edits. However, this is less preferred, because the edits are not high-level. The edits are close together and should be grouped:
\`\`\`
@@ ... @@ # This is less preferred because edits are close together and should be grouped:
-def factorial(n):
+def factorial(number):
- if n == 0:
+ if number == 0:
return 1
else:
- return n * factorial(n-1)
+ return number * factorial(number-1)
\`\`\`
# Example 1:
FILES
selected file \`test.ts\`:
\`\`\`
x = 1
{{selection}}
z = 3
\`\`\`
SELECTION
\`\`\`const y = 2\`\`\`
INSTRUCTIONS
\`\`\`y = 3\`\`\`
EXPECTED RESULT
We should change the selection from \`\`\`y = 2\`\`\` to \`\`\`y = 3\`\`\`.
\`\`\`
@@ ... @@
-x = 1
-
-y = 2
+x = 1
+
+y = 3
\`\`\`
# Example 2:
FILES
selected file \`Sidebar.tsx\`:
\`\`\`
import React from 'react';
import styles from './Sidebar.module.css';
interface SidebarProps {
items: { label: string; href: string }[];
onItemSelect?: (label: string) => void;
onExtraButtonClick?: () => void;
}
const Sidebar: React.FC<SidebarProps> = ({ items, onItemSelect, onExtraButtonClick }) => {
return (
<div className={styles.sidebar}>
<ul>
{items.map((item, index) => (
<li key={index}>
{{selection}}
className={styles.sidebarButton}
onClick={() => onItemSelect?.(item.label)}
>
{item.label}
</button>
</li>
))}
</ul>
<button className={styles.extraButton} onClick={onExtraButtonClick}>
Extra Action
</button>
</div>
);
};
export default Sidebar;
\`\`\`
SELECTION
\`\`\` <button\`\`\`
INSTRUCTIONS
\`\`\`make all the buttons like this into divs\`\`\`
EXPECTED OUTPUT
We should change all the buttons like the one selected into a div component. Here is the change:
\`\`\`
@@ ... @@
-<div className={styles.sidebar}>
-<ul>
- {items.map((item, index) => (
- <li key={index}>
- <button
- className={styles.sidebarButton}
- onClick={() => onItemSelect?.(item.label)}
- >
- {item.label}
- </button>
- </li>
- ))}
-</ul>
-<button className={styles.extraButton} onClick={onExtraButtonClick}>
- Extra Action
-</button>
-</div>
+<div className={styles.sidebar}>
+<ul>
+ {items.map((item, index) => (
+ <li key={index}>
+ <div
+ className={styles.sidebarButton}
+ onClick={() => onItemSelect?.(item.label)}
+ >
+ {item.label}
+ </div>
+ </li>
+ ))}
+</ul>
+<div className={styles.extraButton} onClick={onExtraButtonClick}>
+ Extra Action
+</div>
+</div>
\`\`\`
`;
const searchDiffChunkInstructions = `
You are a coding assistant that applies a diff to a file. You are given a diff \`diff\`, a list of files \`files\` to apply the diff to, and a selection \`selection\` that you are currently considering in the file.
Determine whether you should modify ANY PART of the selection \`selection\` following the \`diff\`. Return \`true\` if you should modify any part of the selection, and \`false\` if you should not modify any part of it.
# Example 1:
FILES
selected file \`Sidebar.tsx\`:
\`\`\`
import React from 'react';
import styles from './Sidebar.module.css';
interface SidebarProps {
items: { label: string; href: string }[];
onItemSelect?: (label: string) => void;
onExtraButtonClick?: () => void;
}
const Sidebar: React.FC<SidebarProps> = ({ items, onItemSelect, onExtraButtonClick }) => {
return (
<div className={styles.sidebar}>
<ul>
{items.map((item, index) => (
<li key={index}>
<button
className={styles.sidebarButton}
onClick={() => onItemSelect?.(item.label)}
>
{item.label}
</button>
</li>
))}
</ul>
<button className={styles.extraButton} onClick={onExtraButtonClick}>
Extra Action
</button>
</div>
);
};
export default Sidebar;
\`\`\`
DIFF
\`\`\`
@@ ... @@
-<div className={styles.sidebar}>
-<ul>
- {items.map((item, index) => (
- <li key={index}>
- <button
- className={styles.sidebarButton}
- onClick={() => onItemSelect?.(item.label)}
- >
- {item.label}
- </button>
- </li>
- ))}
-</ul>
-<button className={styles.extraButton} onClick={onExtraButtonClick}>
- Extra Action
-</button>
-</div>
+<div className={styles.sidebar}>
+<ul>
+ {items.map((item, index) => (
+ <li key={index}>
+ <div
+ className={styles.sidebarButton}
+ onClick={() => onItemSelect?.(item.label)}
+ >
+ {item.label}
+ </div>
+ </li>
+ ))}
+</ul>
+<div className={styles.extraButton} onClick={onExtraButtonClick}>
+ Extra Action
+</div>
+</div>
\`\`\`
SELECTION
\`\`\`
import React from 'react';
import styles from './Sidebar.module.css';
interface SidebarProps {
items: { label: string; href: string }[];
onItemSelect?: (label: string) => void;
onExtraButtonClick?: () => void;
}
const Sidebar: React.FC<SidebarProps> = ({ items, onItemSelect, onExtraButtonClick }) => {
return (
<div className={styles.sidebar}>
<ul>
{items.map((item, index) => (
\`\`\`
RESULT
The output should be \`true\` because the diff begins on the line with \`<div className={styles.sidebar}>\` and this line is present in the selection.
OUTPUT
\`true\`
`
const writeFileWithDiffInstructions = `
You are a coding assistant that applies a diff to a file. You are given the original file \`original_file\`, a diff \`diff\`, and a new file that you are applying the diff to \`new_file\`.
Please finish writing the new file \`new_file\`, according to the diff \`diff\`.
Directions:
1. Continue exactly where the new file \`new_file\` left off.
2. Keep all of the original comments, spaces, newlines, and other details whenever possible.
3. Note that \`+\` lines represent additions, \`-\` lines represent removals, and space lines \` \` represent no change.
# Example 1:
ORIGINAL_FILE
\`Sidebar.tsx\`:
\`\`\`
import React from 'react';
import styles from './Sidebar.module.css';
interface SidebarProps {
items: { label: string; href: string }[];
onItemSelect?: (label: string) => void;
onExtraButtonClick?: () => void;
}
const Sidebar: React.FC<SidebarProps> = ({ items, onItemSelect, onExtraButtonClick }) => {
return (
<div className={styles.sidebar}>
<ul>
{items.map((item, index) => (
<li key={index}>
<button
className={styles.sidebarButton}
onClick={() => onItemSelect?.(item.label)}
>
{item.label}
</button>
</li>
))}
</ul>
<button className={styles.extraButton} onClick={onExtraButtonClick}>
Extra Action
</button>
</div>
);
};
export default Sidebar;
\`\`\`
DIFF
\`\`\`
@@ ... @@
-<div className={styles.sidebar}>
-<ul>
- {items.map((item, index) => (
- <li key={index}>
- <button
- className={styles.sidebarButton}
- onClick={() => onItemSelect?.(item.label)}
- >
- {item.label}
- </button>
- </li>
- ))}
-</ul>
-<button className={styles.extraButton} onClick={onExtraButtonClick}>
- Extra Action
-</button>
-</div>
+<div className={styles.sidebar}>
+<ul>
+ {items.map((item, index) => (
+ <li key={index}>
+ <div
+ className={styles.sidebarButton}
+ onClick={() => onItemSelect?.(item.label)}
+ >
+ {item.label}
+ </div>
+ </li>
+ ))}
+</ul>
+<div className={styles.extraButton} onClick={onExtraButtonClick}>
+ Extra Action
+</div>
+</div>
\`\`\`
NEW_FILE
\`\`\`
import React from 'react';
import styles from './Sidebar.module.css';
interface SidebarProps {
items: { label: string; href: string }[];
onItemSelect?: (label: string) => void;
onExtraButtonClick?: () => void;
}
const Sidebar: React.FC<SidebarProps> = ({ items, onItemSelect, onExtraButtonClick }) => {
return (
\`\`\`
COMPLETION
\`\`\`
<div className={styles.sidebar}>
<ul>
{items.map((item, index) => (
<li key={index}>
<div
className={styles.sidebarButton}
onClick={() => onItemSelect?.(item.label)}
>
{item.label}
</div>
</li>
))}
</ul>
<div className={styles.extraButton} onClick={onExtraButtonClick}>
Extra Action
</div>
</div>
);
};
export default Sidebar;\`\`\`
`
export {
generateDiffInstructions,
searchDiffChunkInstructions,
writeFileWithDiffInstructions,
};
-209
View File
@@ -1,209 +0,0 @@
import * as vscode from 'vscode';
import { DiffProvider } from './DiffProvider';
import { DiffArea, ChatThreads, MessageFromSidebar, MessageToSidebar } from './common/shared_types';
import { SidebarWebviewProvider } from './SidebarWebviewProvider';
import { v4 as uuidv4 } from 'uuid'
import { applyDiffLazily } from './common/ctrlL';
import { getVoidConfig } from './sidebar/contextForConfig';
import { readFileContentOfUri } from './common/readFileContentOfUri';
import { AbortRef } from './common/sendLLMMessage';
// this comes from vscode.proposed.editorInsets.d.ts
declare module 'vscode' {
export interface WebviewEditorInset {
readonly editor: vscode.TextEditor;
readonly line: number;
readonly height: number;
readonly webview: vscode.Webview;
readonly onDidDispose: Event<void>;
dispose(): void;
}
export namespace window {
export function createWebviewTextEditorInset(editor: vscode.TextEditor, line: number, height: number, options?: vscode.WebviewOptions): WebviewEditorInset;
}
}
const roundRangeToLines = (selection: vscode.Selection) => {
return new vscode.Range(selection.start.line, 0, selection.end.line, Number.MAX_SAFE_INTEGER)
}
export function activate(context: vscode.ExtensionContext) {
// 1. Mount the chat sidebar
const sidebarWebviewProvider = new SidebarWebviewProvider(context);
context.subscriptions.push(
vscode.window.registerWebviewViewProvider(SidebarWebviewProvider.viewId, sidebarWebviewProvider, { webviewOptions: { retainContextWhenHidden: true } })
);
// 2. ctrl+l
context.subscriptions.push(
vscode.commands.registerCommand('void.ctrl+l', () => {
const editor = vscode.window.activeTextEditor
if (!editor) return
// const inset = vscode.window.createWebviewTextEditorInset(editor, 10, 10, {})
// inset.webview.html = `
// <html>
// <body style="pointer-events:none;">Hello World!</body>
// </html>
// `;
// show the sidebar
vscode.commands.executeCommand('workbench.view.extension.voidViewContainer');
// vscode.commands.executeCommand('vscode.moveViewToPanel', CustomViewProvider.viewId); // move to aux bar
// get the range of the selection
const selectionRange = roundRangeToLines(editor.selection);
// get the text the user is selecting
const selectionStr = editor.document.getText(selectionRange);
// get the file the user is in
const filePath = editor.document.uri;
// send message to the webview (Sidebar.tsx)
sidebarWebviewProvider.webview.then(webview => webview.postMessage({ type: 'ctrl+l', selection: { selectionStr, selectionRange, filePath } } satisfies MessageToSidebar));
})
);
// 2.5: ctrl+k
context.subscriptions.push(
vscode.commands.registerCommand('void.ctrl+k', () => {
console.log('CTRLK PRESSED')
const editor = vscode.window.activeTextEditor
if (!editor) return
// get the range of the selection
const selectionRange = roundRangeToLines(editor.selection);
// get the text the user is selecting
const selectionStr = editor.document.getText(selectionRange);
// get the file the user is in
const filePath = editor.document.uri;
// send message to the webview (Sidebar.tsx)
sidebarWebviewProvider.webview.then(webview => webview.postMessage({ type: 'ctrl+k', selection: { selectionStr, selectionRange, filePath } } satisfies MessageToSidebar));
})
);
// 3. Show an approve/reject codelens above each change
const diffProvider = new DiffProvider();
context.subscriptions.push(vscode.languages.registerCodeLensProvider('*', diffProvider));
// 4. Add approve/reject commands
context.subscriptions.push(vscode.commands.registerCommand('void.acceptDiff', async (params) => {
diffProvider.acceptDiff(params)
}));
context.subscriptions.push(vscode.commands.registerCommand('void.rejectDiff', async (params) => {
diffProvider.rejectDiff(params)
}));
// 5. Receive messages from sidebar
sidebarWebviewProvider.webview.then(
webview => {
// top navigation bar commands
context.subscriptions.push(vscode.commands.registerCommand('void.startNewThread', async () => {
webview.postMessage({ type: 'startNewThread' } satisfies MessageToSidebar)
}))
context.subscriptions.push(vscode.commands.registerCommand('void.toggleThreadSelector', async () => {
webview.postMessage({ type: 'toggleThreadSelector' } satisfies MessageToSidebar)
}))
context.subscriptions.push(vscode.commands.registerCommand('void.toggleSettings', async () => {
webview.postMessage({ type: 'toggleSettings' } satisfies MessageToSidebar)
}));
// Receive messages in the extension from the sidebar webview (messages are sent using `postMessage`)
webview.onDidReceiveMessage(async (m: MessageFromSidebar) => {
const abortApplyRef: AbortRef = { current: null }
if (m.type === 'requestFiles') {
// get contents of all file paths
const files = await Promise.all(
m.filepaths.map(async (filepath) => ({ filepath, content: await readFileContentOfUri(filepath) }))
)
// send contents to webview
webview.postMessage({ type: 'files', files, } satisfies MessageToSidebar)
}
else if (m.type === 'applyChanges') {
const editor = vscode.window.activeTextEditor
if (!editor) {
vscode.window.showInformationMessage('No active editor!')
return
}
// create an area to show diffs
const partialDiffArea: Omit<DiffArea, 'diffareaid'> = {
startLine: 0, // in ctrl+L the start and end lines are the full document
endLine: editor.document.lineCount,
originalStartLine: 0,
originalEndLine: editor.document.lineCount,
sweepIndex: null,
}
const diffArea = diffProvider.createDiffArea(editor.document.uri, partialDiffArea, await readFileContentOfUri(editor.document.uri))
const docUri = editor.document.uri
const fileStr = await readFileContentOfUri(docUri)
const voidConfig = getVoidConfig(context.globalState.get('partialVoidConfig') ?? {})
await applyDiffLazily({ docUri, oldFileStr: fileStr, diffRepr: m.diffRepr, voidConfig, diffProvider, diffArea, abortRef: abortApplyRef })
}
else if (m.type === 'getPartialVoidConfig') {
const partialVoidConfig = context.globalState.get('partialVoidConfig') ?? {}
webview.postMessage({ type: 'partialVoidConfig', partialVoidConfig } satisfies MessageToSidebar)
}
else if (m.type === 'persistPartialVoidConfig') {
const partialVoidConfig = m.partialVoidConfig
context.globalState.update('partialVoidConfig', partialVoidConfig)
}
else if (m.type === 'getAllThreads') {
const threads: ChatThreads = context.workspaceState.get('allThreads') ?? {}
webview.postMessage({ type: 'allThreads', threads } satisfies MessageToSidebar)
}
else if (m.type === 'persistThread') {
const threads: ChatThreads = context.workspaceState.get('allThreads') ?? {}
const updatedThreads: ChatThreads = { ...threads, [m.thread.id]: m.thread }
context.workspaceState.update('allThreads', updatedThreads)
}
else if (m.type === 'getDeviceId') {
let deviceId = context.globalState.get('void_deviceid')
if (!deviceId || typeof deviceId !== 'string') {
deviceId = uuidv4()
context.globalState.update('void_deviceid', deviceId)
}
webview.postMessage({ type: 'deviceId', deviceId: deviceId as string } satisfies MessageToSidebar)
}
else {
console.error('unrecognized command', m)
}
})
}
)
// Gets called when user presses ctrl + k (mounts ctrl+k-style codelens)
// TODO need to build this
// const ctrlKCodeLensProvider = new CtrlKCodeLensProvider();
// context.subscriptions.push(vscode.languages.registerCodeLensProvider('*', ctrlKCodeLensProvider));
// context.subscriptions.push(
// vscode.commands.registerCommand('void.ctrl+k', () => {
// const editor = vscode.window.activeTextEditor;
// if (!editor)
// return
// ctrlKCodeLensProvider.addNewCodeLens(editor.document, editor.selection);
// // vscode.commands.executeCommand('editor.action.showHover'); // apparently this refreshes the codelenses by having the internals call provideCodeLenses
// })
// )
}
-131
View File
@@ -1,131 +0,0 @@
import { Range } from 'vscode';
import { diffLines, Change } from 'diff';
import { BaseDiff } from './common/shared_types';
// class Range {
// range: any;
// constructor(startLine, startCol, endLine, endCol) {
// const range = {
// startLine,
// startCol,
// endLine,
// endCol,
// };
// this.range = range;
// }
// }
// Andrew diff algo:
export type SuggestedEdit = {
// start/end of current file
newRange: Range;
// start/end of original file
originalRange: Range;
type: 'insertion' | 'deletion' | 'edit',
originalContent: string, // original content (originalfile[originalStart...originalEnd])
newContent: string,
}
export function findDiffs(oldStr: string, newStr: string) {
// an ordered list of every original line, line added to the new file, and line removed from the old file (order is unambiguous, think about it)
const lineByLineChanges: Change[] = diffLines(oldStr, newStr);
lineByLineChanges.push({ value: '' }) // add a dummy so we flush any streaks we haven't yet at the very end (!line.added && !line.removed)
let oldFileLineNum: number = 0;
let newFileLineNum: number = 0;
let streakStartInNewFile: number | undefined = undefined
let streakStartInOldFile: number | undefined = undefined
let oldStrLines = oldStr.split('\n')
let newStrLines = newStr.split('\n')
const replacements: BaseDiff[] = []
for (let line of lineByLineChanges) {
// no change on this line
if (!line.added && !line.removed) {
// do nothing
// if we were on a streak of +s and -s, end it
if (streakStartInNewFile !== undefined) {
let type: 'edit' | 'insertion' | 'deletion' = 'edit'
let startLine = streakStartInNewFile
let endLine = newFileLineNum - 1 // don't include current line, the edit was up to this line but not including it
let startCol = 0
let endCol = Number.MAX_SAFE_INTEGER
let originalStartLine = streakStartInOldFile!
let originalEndLine = oldFileLineNum - 1 // don't include current line, the edit was up to this line but not including it
let originalStartCol = 0
let originalEndCol = Number.MAX_SAFE_INTEGER
let newContent = newStrLines.slice(startLine, endLine + 1).join('\n')
let originalContent = oldStrLines.slice(originalStartLine, originalEndLine + 1).join('\n')
// if the range is empty, mark it as a deletion / insertion (both won't be true at once)
// DELETION
if (endLine === startLine - 1) {
type = 'deletion'
endLine = startLine
startCol = 0
endCol = 0
newContent += '\n'
}
// INSERTION
else if (originalEndLine === originalStartLine - 1) {
type = 'insertion'
originalEndLine = originalStartLine
originalStartCol = 0
originalEndCol = 0
}
const replacement: BaseDiff = {
type,
range: new Range(startLine, startCol, endLine, endCol),
code: newContent,
originalRange: new Range(originalStartLine, originalStartCol, originalEndLine, originalEndCol),
originalCode: originalContent,
}
replacements.push(replacement)
streakStartInNewFile = undefined
streakStartInOldFile = undefined
}
oldFileLineNum += line.count ?? 0;
newFileLineNum += line.count ?? 0;
}
// line was removed from old file
else if (line.removed) {
// if we weren't on a streak, start one on this current line num
if (streakStartInNewFile === undefined) {
streakStartInNewFile = newFileLineNum
streakStartInOldFile = oldFileLineNum
}
oldFileLineNum += line.count ?? 0 // we processed the line so add 1
}
// line was added to new file
else if (line.added) {
// if we weren't on a streak, start one on this current line num
if (streakStartInNewFile === undefined) {
streakStartInNewFile = newFileLineNum
streakStartInOldFile = oldFileLineNum
}
newFileLineNum += line.count ?? 0; // we processed the line so add 1
}
} // end for
console.debug('Replacements', replacements)
return replacements
}
-20
View File
@@ -1,20 +0,0 @@
import React, { useState } from 'react';
import { useOnVSCodeMessage } from './getVscodeApi';
export const CtrlK = () => {
const [x, sx] = useState('abc')
useOnVSCodeMessage('ctrl+k', () => {
console.log('Ctrl+K pressed')
sx('Pressed ctrl+k')
})
return <>
<div>
{x}
</div>
</>
};
-67
View File
@@ -1,67 +0,0 @@
import React, { useState, useEffect, useRef, useCallback, FormEvent } from "react"
import { CodeSelection, ChatMessage, MessageToSidebar } from "../common/shared_types"
import { awaitVSCodeResponse, getVSCodeAPI, onMessageFromVSCode, useOnVSCodeMessage } from "./getVscodeApi"
import { SidebarThreadSelector } from "./SidebarThreadSelector";
import { SidebarChat } from "./SidebarChat";
import { SidebarSettings } from './SidebarSettings';
import { identifyUser } from "./metrics/posthog";
const Sidebar = () => {
const chatInputRef = useRef<HTMLTextAreaElement | null>(null)
const [tab, setTab] = useState<'threadSelector' | 'chat' | 'settings'>('chat')
// if they pressed the + to add a new chat
useOnVSCodeMessage('startNewThread', (m) => {
setTab('chat');
chatInputRef.current?.focus();
})
// ctrl+l should switch back to chat
useOnVSCodeMessage('ctrl+l', (m) => {
setTab('chat');
chatInputRef.current?.focus();
})
// if they toggled thread selector
useOnVSCodeMessage('toggleThreadSelector', (m) => {
if (tab === 'threadSelector') {
setTab('chat')
chatInputRef.current?.blur();
} else
setTab('threadSelector')
})
// if they toggled settings
useOnVSCodeMessage('toggleSettings', (m) => {
if (tab === 'settings') {
setTab('chat')
chatInputRef.current?.blur();
} else
setTab('settings')
})
return <>
<div className={`flex flex-col h-screen w-full`}>
<div className={`mb-2 h-[30vh] ${tab !== 'threadSelector' ? 'hidden' : ''}`}>
<SidebarThreadSelector onClose={() => setTab('chat')} />
</div>
<div className={`${tab !== 'chat' && tab !== 'threadSelector' ? 'hidden' : ''}`}>
<SidebarChat chatInputRef={chatInputRef} />
</div>
<div className={`${tab !== 'settings' ? 'hidden' : ''}`}>
<SidebarSettings />
</div>
</div>
</>
}
export default Sidebar
-382
View File
@@ -1,382 +0,0 @@
import React, { FormEvent, useCallback, useEffect, useRef, useState } from "react";
import { marked } from 'marked';
import MarkdownRender from "./markdown/MarkdownRender";
import BlockCode from "./markdown/BlockCode";
import { File, ChatMessage, CodeSelection } from "../common/shared_types";
import * as vscode from 'vscode'
import { awaitVSCodeResponse, getVSCodeAPI, onMessageFromVSCode, useOnVSCodeMessage } from "./getVscodeApi";
import { useThreads } from "./contextForThreads";
import { sendLLMMessage } from "../common/sendLLMMessage";
import { useVoidConfig } from "./contextForConfig";
import { generateDiffInstructions } from "../common/systemPrompts";
import { captureEvent } from "./metrics/posthog";
const filesStr = (fullFiles: File[]) => {
return fullFiles.map(({ filepath, content }) =>
`
${filepath.fsPath}
\`\`\`
${content}
\`\`\``).join('\n')
}
const userInstructionsStr = (instructions: string, files: File[], selection: CodeSelection | null) => {
let str = '';
if (files.length > 0) {
str += filesStr(files);
}
if (selection) {
str += `
I am currently selecting this code:
\t\`\`\`${selection.selectionStr}\`\`\`
`;
}
if (files.length > 0 && selection) {
str += `
Please edit the selected code or the entire file following these instructions:
`;
} else if (files.length > 0) {
str += `
Please edit the file following these instructions:
`;
} else if (selection) {
str += `
Please edit the selected code following these instructions:
`;
}
str += `
\t${instructions}
`;
if (files.length > 0) {
str += `
\tIf you make a change, rewrite the entire file.
`; // TODO don't rewrite the whole file on prompt, instead rewrite it when click Apply
}
return str;
};
const getBasename = (pathStr: string) => {
// "unixify" path
pathStr = pathStr.replace(/[/\\]+/g, "/") // replace any / or \ or \\ with /
const parts = pathStr.split("/") // split on /
return parts[parts.length - 1]
}
export const SelectedFiles = ({ files, setFiles, }: { files: vscode.Uri[], setFiles: null | ((files: vscode.Uri[]) => void) }) => {
return (
files.length !== 0 && (
<div className="flex flex-wrap -mx-1 -mb-1">
{files.map((filename, i) => (
<button
key={filename.path}
disabled={!setFiles}
className={`btn btn-secondary btn-sm border border-vscode-input-border rounded flex items-center space-x-2 mx-1 mb-1 disabled:cursor-default`}
type="button"
onClick={() => setFiles?.([...files.slice(0, i), ...files.slice(i + 1, Infinity)])}
>
<span>{getBasename(filename.fsPath)}</span>
{/* X button */}
{!!setFiles && <span className="">
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
className="size-4"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M6 18 18 6M6 6l12 12"
/>
</svg>
</span>}
</button>
))}
</div>
)
)
}
const ChatBubble = ({ chatMessage }: { chatMessage: ChatMessage }) => {
const role = chatMessage.role
const children = chatMessage.displayContent
if (!children)
return null
let chatbubbleContents: React.ReactNode
if (role === 'user') {
chatbubbleContents = <>
<SelectedFiles files={chatMessage.files} setFiles={null} />
{chatMessage.selection?.selectionStr && <BlockCode
text={chatMessage.selection.selectionStr}
buttonsOnHover={null}
/>}
{children}
</>
}
else if (role === 'assistant') {
chatbubbleContents = <MarkdownRender string={children} /> // sectionsHTML
}
return <div className={`${role === 'user' ? 'text-right' : 'text-left'}`}>
<div className={`inline-block p-2 rounded-lg space-y-2 ${role === 'user' ? 'bg-vscode-input-bg text-vscode-input-fg' : ''} max-w-full`}>
{chatbubbleContents}
</div>
</div>
}
export const SidebarChat = ({ chatInputRef }: { chatInputRef: React.RefObject<HTMLTextAreaElement> }) => {
// state of current message
const [selection, setSelection] = useState<CodeSelection | null>(null) // the code the user is selecting
const [files, setFiles] = useState<vscode.Uri[]>([]) // the names of the files in the chat
const [instructions, setInstructions] = useState('') // the user's instructions
// state of chat
const [messageStream, setMessageStream] = useState('')
const [isLoading, setIsLoading] = useState(false)
const abortFnRef = useRef<(() => void) | null>(null)
const [latestError, setLatestError] = useState('')
// higher level state
const { getAllThreads, getCurrentThread, addMessageToHistory, startNewThread, switchToThread } = useThreads()
const { voidConfig } = useVoidConfig()
// only captures number of messages and message "shape", no actual code, instructions, prompts, etc
const captureChatEvent = useCallback((eventId: string, extras?: object) => {
const whichApi = voidConfig.default['whichApi']
const messages = getCurrentThread()?.messages
captureEvent(eventId, {
whichApi: whichApi,
numMessages: messages?.length,
messagesShape: messages?.map(msg => ({ role: msg.role, length: msg.displayContent?.length })),
version: '2024-10-19',
...extras,
})
}, [getCurrentThread, voidConfig.default])
// if they pressed the + to add a new chat
useOnVSCodeMessage('startNewThread', (m) => {
const allThreads = getAllThreads()
// find a thread with 0 messages and switch to it
for (let threadId in allThreads) {
if (allThreads[threadId].messages.length === 0) {
switchToThread(threadId)
return
}
}
// start a new thread
startNewThread()
})
// if user pressed ctrl+l, add their selection to the sidebar
useOnVSCodeMessage('ctrl+l', (m) => {
setSelection(m.selection)
const filepath = m.selection.filePath
// add current file to the context if it's not already in the files array
if (!files.find(f => f.fsPath === filepath.fsPath))
setFiles(files => [...files, filepath])
})
const isDisabled = !instructions
const formRef = useRef<HTMLFormElement | null>(null)
const onSubmit = async (e: FormEvent<HTMLFormElement>) => {
e.preventDefault()
if (isDisabled) return
if (isLoading) return
setIsLoading(true)
setInstructions('');
formRef.current?.reset(); // reset the form's text when clear instructions or unexpected behavior happens
setSelection(null)
setFiles([])
setLatestError('')
// request file content from vscode and await response
getVSCodeAPI().postMessage({ type: 'requestFiles', filepaths: files })
const relevantFiles = await awaitVSCodeResponse('files')
// add system message to chat history
const systemPromptElt: ChatMessage = { role: 'system', content: generateDiffInstructions }
addMessageToHistory(systemPromptElt)
const userContent = userInstructionsStr(instructions, relevantFiles.files, selection)
const newHistoryElt: ChatMessage = { role: 'user', content: userContent, displayContent: instructions, selection, files }
addMessageToHistory(newHistoryElt)
captureChatEvent('Chat - Sending Message', { messageLength: instructions.length })
const submit_time = new Date()
// send message to LLM
sendLLMMessage({
messages: [...(getCurrentThread()?.messages ?? []).map(m => ({ role: m.role, content: m.content })),],
onText: (newText, fullText) => setMessageStream(fullText),
onFinalMessage: (content) => {
captureChatEvent('Chat - Received Full Message', { messageLength: content.length, duration: new Date().getMilliseconds() - submit_time.getMilliseconds() })
// add assistant's message to chat history, and clear selection
const newHistoryElt: ChatMessage = { role: 'assistant', content, displayContent: content }
addMessageToHistory(newHistoryElt)
setMessageStream('')
setIsLoading(false)
},
onError: (error) => {
captureChatEvent('Chat - Error', { error })
// add assistant's message to chat history, and clear selection
let content = messageStream; // just use the current content
const newHistoryElt: ChatMessage = { role: 'assistant', content, displayContent: content, }
addMessageToHistory(newHistoryElt)
setMessageStream('')
setIsLoading(false)
setLatestError(error)
},
voidConfig,
abortRef: abortFnRef,
})
}
const onAbort = useCallback(() => {
captureChatEvent('Chat - Abort', { messageLengthSoFar: messageStream.length })
// abort claude
abortFnRef.current?.()
// if messageStream was not empty, add it to the history
const llmContent = messageStream || '(null)'
const newHistoryElt: ChatMessage = { role: 'assistant', content: llmContent, displayContent: messageStream, }
addMessageToHistory(newHistoryElt)
setMessageStream('')
setIsLoading(false)
}, [captureChatEvent, messageStream, addMessageToHistory])
return <>
<div className="overflow-x-hidden space-y-4">
{/* previous messages */}
{getCurrentThread() !== null && getCurrentThread()?.messages.map((message, i) =>
<ChatBubble key={i} chatMessage={message} />
)}
{/* message stream */}
<ChatBubble chatMessage={{ role: 'assistant', content: messageStream, displayContent: messageStream }} />
</div>
{/* chatbar */}
<div className="shrink-0 py-4">
{/* selection */}
<div className="text-left">
<div className="relative">
<div className="input">
{/* selection */}
{(files.length || selection?.selectionStr) && <div className="p-2 pb-0 space-y-2">
{/* selected files */}
<SelectedFiles files={files} setFiles={setFiles} />
{/* selected code */}
{!!selection?.selectionStr && (
<BlockCode text={selection.selectionStr}
buttonsOnHover={(
<button
onClick={() => setSelection(null)}
className="btn btn-secondary btn-sm border border-vscode-input-border rounded"
>
Remove
</button>
)} />
)}
</div>}
<form
ref={formRef}
className="flex flex-row items-center rounded-md p-2"
onKeyDown={(e) => { if (e.key === 'Enter' && !e.shiftKey) onSubmit(e) }}
onSubmit={(e) => {
console.log('submit!')
onSubmit(e)
}}>
{/* input */}
<textarea
ref={chatInputRef}
onChange={(e) => { setInstructions(e.target.value) }}
className="w-full p-2 leading-tight resize-none max-h-[50vh] overflow-hidden bg-transparent border-none !outline-none"
placeholder="Ctrl+L to select"
rows={1}
onInput={e => { e.currentTarget.style.height = 'auto'; e.currentTarget.style.height = e.currentTarget.scrollHeight + 'px' }} // Adjust height dynamically
/>
{isLoading ?
// stop button
<button
onClick={onAbort}
type='button'
className="btn btn-primary font-bold size-8 flex justify-center items-center rounded-full p-2 max-h-10"
>
<svg
className='scale-50'
stroke="currentColor" fill="currentColor" strokeWidth="0" viewBox="0 0 24 24" height="24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M24 24H0V0h24v24z"></path>
</svg>
</button>
:
// submit button (up arrow)
<button
className="btn btn-primary font-bold size-8 flex justify-center items-center rounded-full p-2 max-h-10"
disabled={isDisabled}
type='submit'
>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<line x1="12" y1="19" x2="12" y2="5"></line>
<polyline points="5 12 12 5 19 12"></polyline>
</svg>
</button>
}
</form>
</div>
</div>
</div>
{/* error message */}
{!latestError ? null : <div>
{latestError}
</div>}
</div>
</>
}
@@ -1,105 +0,0 @@
import React, { useState } from "react";
import { configFields, useVoidConfig, VoidConfigField } from "./contextForConfig";
const SettingOfFieldAndParam = ({ field, param }: { field: VoidConfigField, param: string }) => {
const { voidConfig, partialVoidConfig, voidConfigInfo, setConfigParam } = useVoidConfig()
const { enumArr, defaultVal, description } = voidConfigInfo[field][param]
const val = partialVoidConfig[field]?.[param] ?? defaultVal // current value of this item
const updateState = (newValue: string) => { setConfigParam(field, param, newValue) }
const resetButton = <button
disabled={val === defaultVal}
title={val === defaultVal ? 'This is the default value.' : `Revert value to '${defaultVal}'?`}
className='group btn btn-sm disabled:opacity-75 disabled:cursor-default'
onClick={() => updateState(defaultVal)}
>
<svg
className='size-5 group-disabled:stroke-current group-disabled:fill-current group-hover:stroke-red-600 group-hover:fill-red-600 duration-200'
fill="currentColor" strokeWidth="0" viewBox="0 0 16 16" height="200px" width="200px" xmlns="http://www.w3.org/2000/svg"><path fillRule="evenodd" clipRule="evenodd" d="M3.5 2v3.5L4 6h3.5V5H4.979l.941-.941a3.552 3.552 0 1 1 5.023 5.023L5.746 14.28l.72.72 5.198-5.198A4.57 4.57 0 0 0 5.2 3.339l-.7.7V2h-1z"></path>
</svg>
</button>
const inputElement = enumArr === undefined ?
// string
(<input
className='input p-1 w-full'
type="text"
value={val}
onChange={(e) => updateState(e.target.value)}
/>)
:
// enum
(<select
className='dropdown p-1 w-full'
value={val}
onChange={(e) => updateState(e.target.value)}
>
{enumArr.map((option) => (
<option key={option} value={option}>
{option}
</option>
))}
</select>)
return <div>
<label className='hidden'>{param}</label>
<span>{description}</span>
<div className='flex items-center'>
{inputElement}
{resetButton}
</div>
</div>
}
export const SidebarSettings = () => {
const { voidConfig, voidConfigInfo } = useVoidConfig()
const current_field = voidConfig.default['whichApi'] as VoidConfigField
return (
<div className='space-y-4 py-2 overflow-y-auto'>
{/* choose the field */}
<div className='outline-vscode-input-bg'>
<SettingOfFieldAndParam
field='default'
param='whichApi'
/>
<SettingOfFieldAndParam
field='default'
param='maxTokens'
/>
</div>
<hr />
{/* render all fields, but hide the ones not visible for fast tab switching */}
{configFields.map(field => {
return <div
key={field}
className={`flex flex-col gap-y-2 ${field !== current_field ? 'hidden' : ''}`}
>
{Object.keys(voidConfigInfo[field]).map((param) => (
<SettingOfFieldAndParam
key={param}
field={field}
param={param}
/>
))}
</div>
})}
{/* Remove this after 10/21/24, this is just to give developers a heads up about the recent change */}
<div className='pt-20'>
{`We recently updated Settings. To copy your old Void settings over, press Ctrl+Shift+P, `}
{`type 'Open User Settings (JSON)',`}
{` and look for 'void.'. `}
</div>
</div>
)
}
@@ -1,79 +0,0 @@
import React from "react";
import { ThreadsProvider, useThreads } from "./contextForThreads";
const truncate = (s: string) => {
let len = s.length
const TRUNC_AFTER = 16
if (len >= TRUNC_AFTER)
s = s.substring(0, TRUNC_AFTER) + '...'
return s
}
export const SidebarThreadSelector = ({ onClose }: { onClose: () => void }) => {
const { getAllThreads, getCurrentThread, switchToThread } = useThreads()
const allThreads = getAllThreads()
// sorted by most recent to least recent
const sortedThreadIds = Object.keys(allThreads ?? {}).sort((threadId1, threadId2) => allThreads![threadId1].lastModified > allThreads![threadId2].lastModified ? 1 : -1)
return (
<div className="flex flex-col gap-y-1">
{/* X button at top right */}
<div className="text-right">
<button className="btn btn-sm" onClick={onClose}>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
className="size-4"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M6 18 18 6M6 6l12 12"
/>
</svg>
</button>
</div>
{/* a list of all the past threads */}
<div className='flex flex-col gap-y-1 max-h-80 overflow-y-auto'>
{sortedThreadIds.map((threadId) => {
if (!allThreads)
return <>Error: Threads not found.</>
const pastThread = allThreads[threadId]
let btnStringArr = []
let msg1 = truncate(allThreads[threadId].messages[0]?.displayContent ?? '(empty)')
btnStringArr.push(msg1)
let msg2 = truncate(allThreads[threadId].messages[1]?.displayContent ?? '')
if (msg2)
btnStringArr.push(msg2)
btnStringArr.push(allThreads[threadId].messages.length)
const btnString = btnStringArr.join(' / ')
return (
<button
key={pastThread.id}
className={`btn btn-sm rounded-sm ${pastThread.id === getCurrentThread()?.id ? "btn-primary" : "btn-secondary"}`}
onClick={() => switchToThread(pastThread.id)}
title={new Date(pastThread.createdAt).toLocaleString()}
>
{btnString}
</button>
)
})}
</div>
</div>
)
}
@@ -1,275 +0,0 @@
import React, { ReactNode, createContext, useCallback, useContext, useEffect, useRef, useState, } from "react"
import { awaitVSCodeResponse, getVSCodeAPI, useOnVSCodeMessage } from "./getVscodeApi"
const configEnum = <EnumArr extends readonly string[]>(description: string, defaultVal: EnumArr[number], enumArr: EnumArr) => {
return {
description,
defaultVal,
enumArr,
}
}
const configString = (description: string, defaultVal: string) => {
return {
description,
defaultVal,
enumArr: undefined,
}
}
// fields you can customize (don't forget 'default' - it isn't included here!)
export const configFields = [
'anthropic',
'openAI',
'greptile',
'ollama',
'openRouter',
'openAICompatible',
'azure'
] as const
const voidConfigInfo: Record<
typeof configFields[number] | 'default', {
[prop: string]: {
description: string,
enumArr?: readonly string[] | undefined,
defaultVal: string,
},
}
> = {
default: {
whichApi: configEnum(
"API Provider.",
'anthropic',
configFields,
),
maxTokens: configEnum(
"Max number of tokens to output.",
'1024',
[
"1024",
"2048",
"4096",
"8192"
] as const,
),
},
anthropic: {
apikey: configString('Anthropic API key.', ''),
model: configEnum(
"Anthropic model to use.",
'claude-3-5-sonnet-20240620',
[
"claude-3-5-sonnet-20240620",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307"
] as const,
),
},
openAI: {
apikey: configString('OpenAI API key.', ''),
model: configEnum(
'OpenAI model to use.',
'gpt-4o',
[
"o1-preview",
"o1-mini",
"gpt-4o",
"gpt-4o-2024-05-13",
"gpt-4o-2024-08-06",
"gpt-4o-mini",
"gpt-4o-mini-2024-07-18",
"gpt-4-turbo",
"gpt-4-turbo-2024-04-09",
"gpt-4-turbo-preview",
"gpt-4-0125-preview",
"gpt-4-1106-preview",
"gpt-4",
"gpt-4-0613",
"gpt-3.5-turbo-0125",
"gpt-3.5-turbo",
"gpt-3.5-turbo-1106"
] as const
),
},
greptile: {
apikey: configString('Greptile API key.', ''),
githubPAT: configString('Github PAT that Greptile uses to access your repository', ''),
remote: configEnum(
'Repo location',
'github',
[
'github',
'gitlab'
] as const
),
repository: configString('Repository identifier in "owner/repository" format.', ''),
branch: configString('Name of the branch to use.', 'main'),
},
ollama: {
endpoint: configString(
'The endpoint of your Ollama instance. Start Ollama by running `OLLAMA_ORIGINS="vscode-webview://*" ollama serve`.',
'http://127.0.0.1:11434'
),
// TODO we should allow user to select model inside Void, but for now we'll just let them handle the Ollama setup on their own
// model: configEnum(
// 'Ollama model to use.',
// 'llama3.1',
// ["codegemma", "codegemma:2b", "codegemma:7b", "codellama", "codellama:7b", "codellama:13b", "codellama:34b", "codellama:70b", "codellama:code", "codellama:python", "command-r", "command-r:35b", "command-r-plus", "command-r-plus:104b", "deepseek-coder-v2", "deepseek-coder-v2:16b", "deepseek-coder-v2:236b", "falcon2", "falcon2:11b", "firefunction-v2", "firefunction-v2:70b", "gemma", "gemma:2b", "gemma:7b", "gemma2", "gemma2:2b", "gemma2:9b", "gemma2:27b", "llama2", "llama2:7b", "llama2:13b", "llama2:70b", "llama3", "llama3:8b", "llama3:70b", "llama3-chatqa", "llama3-chatqa:8b", "llama3-chatqa:70b", "llama3-gradient", "llama3-gradient:8b", "llama3-gradient:70b", "llama3.1", "llama3.1:8b", "llama3.1:70b", "llama3.1:405b", "llava", "llava:7b", "llava:13b", "llava:34b", "llava-llama3", "llava-llama3:8b", "llava-phi3", "llava-phi3:3.8b", "mistral", "mistral:7b", "mistral-large", "mistral-large:123b", "mistral-nemo", "mistral-nemo:12b", "mixtral", "mixtral:8x7b", "mixtral:8x22b", "moondream", "moondream:1.8b", "openhermes", "openhermes:v2.5", "phi3", "phi3:3.8b", "phi3:14b", "phi3.5", "phi3.5:3.8b", "qwen", "qwen:7b", "qwen:14b", "qwen:32b", "qwen:72b", "qwen:110b", "qwen2", "qwen2:0.5b", "qwen2:1.5b", "qwen2:7b", "qwen2:72b", "smollm", "smollm:135m", "smollm:360m", "smollm:1.7b"] as const
// ),
},
openRouter: {
model: configString(
'OpenRouter model to use.',
'openai/gpt-4o'
),
apikey: configString('OpenRouter API key.', ''),
},
openAICompatible: {
endpoint: configString('The baseUrl (exluding /chat/completions).', 'http://127.0.0.1:11434/v1'),
model: configString('The name of the model to use.', 'gpt-4o'),
apikey: configString('Your API key.', ''),
},
azure: {
// "void.azure.apiKey": {
// "type": "string",
// "description": "Azure API key."
// },
// "void.azure.deploymentId": {
// "type": "string",
// "description": "Azure API deployment ID."
// },
// "void.azure.resourceName": {
// "type": "string",
// "description": "Name of the Azure OpenAI resource. Either this or `baseURL` can be used. \nThe resource name is used in the assembled URL: `https://{resourceName}.openai.azure.com/openai/deployments/{modelId}{path}`"
// },
// "void.azure.providerSettings": {
// "type": "object",
// "properties": {
// "baseURL": {
// "type": "string",
// "default": "https://${resourceName}.openai.azure.com/openai/deployments",
// "description": "Azure API base URL."
// },
// "headers": {
// "type": "object",
// "description": "Custom headers to include in the requests."
// }
// }
// },
},
}
// this is the type that comes with metadata like desc, default val, etc
type VoidConfigInfo = typeof voidConfigInfo
export type VoidConfigField = keyof typeof voidConfigInfo // typeof configFields[number]
// this is the type that specifies the user's actual config
export type PartialVoidConfig = {
[K in keyof typeof voidConfigInfo]?: {
[P in keyof typeof voidConfigInfo[K]]?: typeof voidConfigInfo[K][P]['defaultVal']
}
}
export type VoidConfig = {
[K in keyof typeof voidConfigInfo]: {
[P in keyof typeof voidConfigInfo[K]]: typeof voidConfigInfo[K][P]['defaultVal']
}
}
export const getVoidConfig = (currentConfig: PartialVoidConfig): VoidConfig => {
const config = {} as PartialVoidConfig
for (let field of [...configFields, 'default'] as const) {
config[field] = {}
for (let prop in voidConfigInfo[field]) {
config[field][prop] = currentConfig[field]?.[prop] || voidConfigInfo[field][prop].defaultVal
}
}
return config as VoidConfig
}
const defaultVoidConfig: VoidConfig = getVoidConfig({})
// const [stateRef, setState] = useInstantState(initVal)
// setState instantly changes the value of stateRef instead of having to wait until the next render
const useInstantState = <T,>(initVal: T) => {
const stateRef = useRef<T>(initVal)
const [_, setS] = useState<T>(initVal)
const setState = useCallback((newVal: T) => {
setS(newVal);
stateRef.current = newVal;
}, [])
return [stateRef as React.RefObject<T>, setState] as const // make s.current readonly - setState handles all changes
}
type SetConfigParamType = <K extends VoidConfigField>(field: K, param: keyof VoidConfigInfo[K], newVal: string) => void
type ConfigValueType = {
voidConfig: VoidConfig,
voidConfigInfo: VoidConfigInfo,
partialVoidConfig: PartialVoidConfig,
setConfigParam: SetConfigParamType
}
const ConfigContext = createContext<ConfigValueType>(undefined as unknown as ConfigValueType)
export function ConfigProvider({ children }: { children: ReactNode }) {
const [partialVoidConfig, setPartialVoidConfig] = useInstantState<PartialVoidConfig>({}) // the user's selections
const [voidConfig, setVoidConfig] = useState<VoidConfig>(defaultVoidConfig)
// get the config on mount
useEffect(() => {
getVSCodeAPI().postMessage({ type: 'getPartialVoidConfig' })
awaitVSCodeResponse('partialVoidConfig').then((m) => {
setPartialVoidConfig(m.partialVoidConfig)
const newFullConfig = getVoidConfig(m.partialVoidConfig)
setVoidConfig(newFullConfig)
})
}, [setPartialVoidConfig])
// return the provider
return (<ConfigContext.Provider
value={{
voidConfig,
voidConfigInfo,
partialVoidConfig: partialVoidConfig.current ?? {},
setConfigParam: (field, param, newVal) => {
const newPartialConfig: PartialVoidConfig = {
...partialVoidConfig.current,
[field]: {
...partialVoidConfig.current?.[field],
[param]: newVal
}
}
setPartialVoidConfig(newPartialConfig)
const newFullConfig = getVoidConfig(newPartialConfig)
setVoidConfig(newFullConfig)
getVSCodeAPI().postMessage({ type: 'persistPartialVoidConfig', partialVoidConfig: newPartialConfig })
}
}}
>
{children}
</ConfigContext.Provider>
)
}
export function useVoidConfig(): ConfigValueType {
const context = useContext<ConfigValueType>(ConfigContext)
if (context === undefined) {
throw new Error("useVoidConfig missing Provider")
}
return context
}
@@ -1,106 +0,0 @@
import React, { ReactNode, createContext, useCallback, useContext, useEffect, useRef, useState, } from "react"
import { ChatMessage, ChatThreads } from "../common/shared_types"
import { awaitVSCodeResponse, getVSCodeAPI } from "./getVscodeApi"
// a "thread" means a chat message history
type ConfigForThreadsValueType = {
readonly getAllThreads: () => ChatThreads;
readonly getCurrentThread: () => ChatThreads[string] | null;
addMessageToHistory: (message: ChatMessage) => void;
switchToThread: (threadId: string) => void;
startNewThread: () => void;
}
const ThreadsContext = createContext<ConfigForThreadsValueType>(undefined as unknown as ConfigForThreadsValueType)
const createNewThread = () => {
const now = new Date().toISOString()
return {
id: new Date().getTime().toString(),
createdAt: now,
lastModified: now,
messages: [],
}
}
// const [stateRef, setState] = useInstantState(initVal)
// setState instantly changes the value of stateRef instead of having to wait until the next render
const useInstantState = <T,>(initVal: T) => {
const stateRef = useRef<T>(initVal)
const [_, setS] = useState<T>(initVal)
const setState = useCallback((newVal: T) => {
setS(newVal);
stateRef.current = newVal;
}, [])
return [stateRef as React.RefObject<T>, setState] as const // make s.current readonly - setState handles all changes
}
export function ThreadsProvider({ children }: { children: ReactNode }) {
const [allThreadsRef, setAllThreads] = useInstantState<ChatThreads>({})
const [currentThreadIdRef, setCurrentThreadId] = useInstantState<string | null>(null)
// this loads allThreads in on mount
useEffect(() => {
getVSCodeAPI().postMessage({ type: 'getAllThreads' })
awaitVSCodeResponse('allThreads')
.then(response => {
setAllThreads(response.threads)
})
}, [setAllThreads])
return (
<ThreadsContext.Provider
value={{
getAllThreads: () => allThreadsRef.current ?? {},
getCurrentThread: () => currentThreadIdRef.current ? allThreadsRef.current?.[currentThreadIdRef.current] ?? null : null,
addMessageToHistory: (message: ChatMessage) => {
let currentThread: ChatThreads[string]
if (!(currentThreadIdRef.current === null || allThreadsRef.current === null)) {
currentThread = allThreadsRef.current[currentThreadIdRef.current]
}
else {
currentThread = createNewThread()
setCurrentThreadId(currentThread.id)
}
setAllThreads({
...allThreadsRef.current,
[currentThread.id]: {
...currentThread,
lastModified: new Date().toISOString(),
messages: [...currentThread.messages, message],
}
})
getVSCodeAPI().postMessage({ type: "persistThread", thread: currentThread })
},
switchToThread: (threadId: string) => {
setCurrentThreadId(threadId);
},
startNewThread: () => {
const newThread = createNewThread()
setAllThreads({
...allThreadsRef.current,
[newThread.id]: newThread
})
setCurrentThreadId(newThread.id)
},
}}
>
{children}
</ThreadsContext.Provider>
)
}
export function useThreads(): ConfigForThreadsValueType {
const context = useContext<ConfigForThreadsValueType>(ThreadsContext)
if (context === undefined) {
throw new Error("useThreads missing Provider")
}
return context
}
@@ -1,94 +0,0 @@
import { useEffect } from "react";
import { MessageFromSidebar, MessageToSidebar, } from "../common/shared_types";
import { v4 as uuidv4 } from 'uuid';
type Command = MessageToSidebar['type']
// messageType -> res[]
const onetimeCallbacks: { [C in Command]: ((res: any) => void)[] } = {
"ctrl+l": [],
"ctrl+k": [],
"files": [],
"partialVoidConfig": [],
"startNewThread": [],
"allThreads": [],
"toggleThreadSelector": [],
"toggleSettings": [],
"deviceId": [],
}
// messageType -> id -> res
const callbacks: { [C in Command]: { [id: string]: ((res: any) => void) } } = {
"ctrl+l": {},
"ctrl+k": {},
"files": {},
"partialVoidConfig": {},
"startNewThread": {},
"allThreads": {},
"toggleThreadSelector": {},
"toggleSettings": {},
"deviceId": {}
}
// use this function to await responses
export const awaitVSCodeResponse = <C extends Command>(c: C) => {
let result: Promise<MessageToSidebar & { type: C }> = new Promise((res, rej) => {
onetimeCallbacks[c].push(res)
})
return result
}
// use this function to add a listener to a certain type of message
export const useOnVSCodeMessage = <C extends Command>(messageType: C, fn: (e: MessageToSidebar & { type: C }) => void) => {
useEffect(() => {
const mType = messageType
const callbackId: string = uuidv4();
// @ts-ignore
callbacks[mType][callbackId] = fn;
return () => { delete callbacks[mType][callbackId] }
}, [messageType, fn])
}
// this function gets called whenever sidebar receives a message - it should only mount once
export const onMessageFromVSCode = (m: MessageToSidebar) => {
// resolve all promises for this message type
for (let res of onetimeCallbacks[m.type]) {
res(m)
onetimeCallbacks[m.type].splice(0) // clear the array
}
// call the listener for this message type
for (let res of Object.values(callbacks[m.type])) {
res(m)
}
}
type AcquireVsCodeApiType = () => {
postMessage(message: MessageFromSidebar): void;
// setState(state: any): void; // getState and setState are made obsolete by us using { retainContextWhenHidden: true }
// getState(): any;
};
// VS Code exposes the function acquireVsCodeApi() to us, this variable makes sure it only gets called once
let vsCodeApi: ReturnType<AcquireVsCodeApiType> | undefined;
export function getVSCodeAPI(): ReturnType<AcquireVsCodeApiType> {
if (vsCodeApi)
return vsCodeApi;
try {
// @ts-expect-error
// eslint-disable-next-line no-undef
vsCodeApi = acquireVsCodeApi();
return vsCodeApi!;
} catch (error) {
console.error('Failed to acquire VS Code API:', error);
throw new Error('This script must be run in a VS Code webview context');
}
}
-66
View File
@@ -1,66 +0,0 @@
import * as React from "react"
import { useEffect } from "react"
import * as ReactDOM from "react-dom/client"
import Sidebar from "./Sidebar"
import { CtrlK } from "./CtrlK"
import { ThreadsProvider } from "./contextForThreads"
import { ConfigProvider } from "./contextForConfig"
import { MessageToSidebar } from "../common/shared_types"
import { awaitVSCodeResponse, getVSCodeAPI, onMessageFromVSCode } from "./getVscodeApi"
import { identifyUser, initPosthog } from "./metrics/posthog"
if (typeof document === "undefined") {
console.log("index.tsx error: document was undefined")
}
const CommonEffects = () => {
// initialize posthog
useEffect(() => {
initPosthog()
}, [])
// when we get the deviceid, identify the user
useEffect(() => {
getVSCodeAPI().postMessage({ type: 'getDeviceId' });
awaitVSCodeResponse('deviceId').then((m => {
identifyUser(m.deviceId)
}))
}, [])
// Receive messages from the VSCode extension
useEffect(() => {
const listener = (event: MessageEvent) => {
const m = event.data as MessageToSidebar;
onMessageFromVSCode(m)
}
window.addEventListener('message', listener);
return () => window.removeEventListener('message', listener)
}, [])
return null
}
(() => {
// mount the sidebar on the id="root" element
const rootElement = document.getElementById("root")!
console.log("Void root Element:", rootElement)
const sidebar = (<>
<CommonEffects />
<ThreadsProvider>
<ConfigProvider>
<Sidebar />
</ConfigProvider>
</ThreadsProvider>
<ConfigProvider>
<CtrlK />
</ConfigProvider>
</>)
const root = ReactDOM.createRoot(rootElement)
root.render(sidebar)
})();
@@ -1,42 +0,0 @@
import React, { ReactNode, useCallback, useEffect, useState } from "react"
import SyntaxHighlighter from "react-syntax-highlighter";
import { atomOneDarkReasonable } from "react-syntax-highlighter/dist/esm/styles/hljs";
const BlockCode = ({ text, buttonsOnHover, language }: { text: string, buttonsOnHover?: ReactNode, language?: string }) => {
const customStyle = {
...atomOneDarkReasonable,
'code[class*="language-"]': {
...atomOneDarkReasonable['code[class*="language-"]'],
background: "none",
},
}
return (<>
<div className={`relative group w-full bg-vscode-sidebar-bg overflow-hidden isolate`}>
{!toolbar ? null : (
<div className="absolute top-0 right-0 opacity-0 group-hover:opacity-100 duration-200">
<div className="flex space-x-2 p-2">{buttonsOnHover === null ? null : buttonsOnHover}</div>
</div>
)}
<div
className={`overflow-x-auto rounded-sm text-vscode-editor-fg bg-vscode-editor-bg`}
>
<SyntaxHighlighter
language={language ?? 'plaintext'} // TODO must auto detect language
style={customStyle}
className={"rounded-sm"}
>
{text}
</SyntaxHighlighter>
</div>
</div>
</>
)
}
export default BlockCode
@@ -1,223 +0,0 @@
import React, { JSX, useCallback, useEffect, useState } from "react"
import { marked, MarkedToken, Token, TokensList } from "marked"
import BlockCode from "./BlockCode"
import { getVSCodeAPI } from "../getVscodeApi"
enum CopyButtonState {
Copy = "Copy",
Copied = "Copied!",
Error = "Could not copy",
}
const COPY_FEEDBACK_TIMEOUT = 1000 // amount of time to say 'Copied!'
const CodeButtonsOnHover = ({ diffRepr: text }: { diffRepr: string }) => {
const [copyButtonState, setCopyButtonState] = useState(CopyButtonState.Copy)
useEffect(() => {
if (copyButtonState !== CopyButtonState.Copy) {
setTimeout(() => {
setCopyButtonState(CopyButtonState.Copy)
}, COPY_FEEDBACK_TIMEOUT)
}
}, [copyButtonState])
const onCopy = useCallback(() => {
navigator.clipboard.writeText(text).then(
() => {
setCopyButtonState(CopyButtonState.Copied)
},
() => {
setCopyButtonState(CopyButtonState.Error)
}
)
}, [text])
return <>
<button
className="btn btn-secondary btn-sm border border-vscode-input-border rounded"
onClick={onCopy}
>
{copyButtonState}
</button>
<button
className="btn btn-secondary btn-sm border border-vscode-input-border rounded"
onClick={async () => {
getVSCodeAPI().postMessage({ type: "applyChanges", diffRepr: text })
}}
>
Apply
</button>
</>
}
const RenderToken = ({ token, nested = false }: { token: Token | string, nested?: boolean }): JSX.Element => {
// deal with built-in tokens first (assume marked token)
const t = token as MarkedToken
if (t.type === "space") {
return <span>{t.raw}</span>
}
if (t.type === "code") {
return <BlockCode
text={t.text}
language={t.lang}
buttonsOnHover={<CodeButtonsOnHover diffRepr={t.text} />}
/>
}
if (t.type === "heading") {
const HeadingTag = `h${t.depth}` as keyof JSX.IntrinsicElements
return <HeadingTag>{t.text}</HeadingTag>
}
if (t.type === "table") {
return (
<table>
<thead>
<tr>
{t.header.map((cell: any, index: number) => (
<th key={index} style={{ textAlign: t.align[index] || "left" }}>
{cell.raw}
</th>
))}
</tr>
</thead>
<tbody>
{t.rows.map((row: any[], rowIndex: number) => (
<tr key={rowIndex}>
{row.map((cell: any, cellIndex: number) => (
<td
key={cellIndex}
style={{ textAlign: t.align[cellIndex] || "left" }}
>
{cell.raw}
</td>
))}
</tr>
))}
</tbody>
</table>
)
}
if (t.type === "hr") {
return <hr />
}
if (t.type === "blockquote") {
return <blockquote>{t.text}</blockquote>
}
if (t.type === "list") {
const ListTag = t.ordered ? "ol" : "ul"
return (
<ListTag
start={t.start ? t.start : undefined}
className={`list-inside ${t.ordered ? "list-decimal" : "list-disc"}`}
>
{t.items.map((item, index) => (
<li key={index}>
{item.task && (
<input type="checkbox" checked={item.checked} readOnly />
)}
<MarkdownRender string={item.text} nested={true} />
</li>
))}
</ListTag>
)
}
if (t.type === "paragraph") {
const contents = <>
{t.tokens.map((token, index) => (
<RenderToken key={index} token={token} />
))}
</>
if (nested)
return contents
return <p>{contents}</p>
}
// don't actually render <html> tags, just render strings of them
if (t.type === "html") {
return (
<pre>
{`<html>`}
{t.raw}
{`</html>`}
</pre>
)
}
if (t.type === "text" || t.type === "escape") {
return <span>{t.raw}</span>
}
if (t.type === "def") {
return <></> // Definitions are typically not rendered
}
if (t.type === "link") {
return (
<a href={t.href} title={t.title ?? undefined}>
{t.text}
</a>
)
}
if (t.type === "image") {
return <img src={t.href} alt={t.text} title={t.title ?? undefined} />
}
if (t.type === "strong") {
return <strong>{t.text}</strong>
}
if (t.type === "em") {
return <em>{t.text}</em>
}
// inline code
if (t.type === "codespan") {
return (
<code className="text-vscode-editor-fg bg-vscode-editor-bg px-1 rounded-sm font-mono">
{t.text}
</code>
)
}
if (t.type === "br") {
return <br />
}
// strikethrough
if (t.type === "del") {
return <del>{t.text}</del>
}
// default
return (
<div className="bg-orange-50 rounded-sm overflow-hidden">
<span className="text-xs text-orange-500">Unknown type:</span>
{t.raw}
</div>
)
}
const MarkdownRender = ({ string, nested = false }: { string: string, nested?: boolean }) => {
const tokens = marked.lexer(string); // https://marked.js.org/using_pro#renderer
return (
<>
{tokens.map((token, index) => (
<RenderToken key={index} token={token} nested={nested} />
))}
</>
)
}
export default MarkdownRender
@@ -1,20 +0,0 @@
import posthog from 'posthog-js'
export const identifyUser = (id: string) => {
posthog.identify(id)
}
export const captureEvent = (eventId: string, properties: object) => {
posthog.capture(eventId, properties)
}
export const initPosthog = () => {
// We send absolutely no code to the server. We only track usage metrics like button clicks, etc. This might change and we might eventually add an opt-in or opt-out.
posthog.init('phc_UanIdujHiLp55BkUTjB1AuBXcasVkdqRwgnwRlWESH2',
{
api_host: 'https://us.i.posthog.com',
person_profiles: 'identified_only' // we only track events from identified users. We identify them in Sidebar
}
)
}
@@ -1,15 +0,0 @@
import * as assert from 'assert';
// You can import and use all API from the 'vscode' module
// as well as import your extension to test it
import * as vscode from 'vscode';
// import * as myExtension from '../../extension';
suite('Extension Test Suite', () => {
vscode.window.showInformationMessage('Start all tests.');
test('Sample test', () => {
assert.strictEqual(-1, [1, 2, 3].indexOf(5));
assert.strictEqual(-1, [1, 2, 3].indexOf(0));
});
});
-31
View File
@@ -1,31 +0,0 @@
/** @type {import('tailwindcss').Config} */
// inject user's vscode theme colors: https://code.visualstudio.com/api/extension-guides/webview#theming-webview-content
module.exports = {
content: ["./src/sidebar/**/*.{html,js,ts,jsx,tsx}"],
theme: {
extend: {
colors: {
vscode: {
"sidebar-bg": "var(--vscode-sideBar-background)",
"editor-bg": "var(--vscode-editor-background)",
"editor-fg": "var(--vscode-editor-foreground)",
"input-bg": "var(--vscode-input-background)",
"input-fg": "var(--vscode-input-foreground)",
"input-border": "var(--vscode-input-border)",
"button-fg": "var(--vscode-button-foreground)",
"button-bg": "var(--vscode-button-background)",
"button-hoverBg": "var(--vscode-button-hoverBackground)",
"button-secondary-fg": "var(--vscode-button-secondaryForeground)",
"button-secondary-bg": "var(--vscode-button-secondaryBackground)",
"button-secondary-hoverBg": "var(--vscode-button-secondaryHoverBackground)",
"dropdown-bg": "var(--vscode-settings-dropdownBackground)",
"dropdown-foreground": "var(--vscode-settings-dropdownForeground)",
"dropdown-border": "var(--vscode-settings-dropdownBorder)",
"focus-border": "var(--vscode-focusBorder)",
},
},
},
},
plugins: [],
};
-30
View File
@@ -1,30 +0,0 @@
{
"include": [
"src/**/*"
],
"exclude": [
"node_modules"
],
"compilerOptions": {
"jsx": "react",
"module": "Node16",
"target": "ES6",
"outDir": "out",
"types": [
"node",
"mocha",
],
"lib": [
"dom",
"es6",
"dom.iterable",
],
"sourceMap": true,
"rootDir": "src",
"strict": true, /* enable all strict type-checking options */
/* Additional Checks */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
}
}
+7315 -3551
View File
File diff suppressed because it is too large Load Diff
+42 -6
View File
@@ -1,14 +1,20 @@
{
"name": "code-oss-dev",
"name": "void-dev",
"productName": "Void",
"version": "1.94.0",
"distro": "ffcc24343ac46468a625666e5b9e673971dd1a1f",
"distro": "this is a commit number if we want to publish on npm",
"homepage": "https://voideditor.com",
"author": {
"name": "Microsoft Corporation"
"name": "Glass Devtools, Inc.",
"email": "andrew@voideditor.com"
},
"license": "MIT",
"main": "./out/main",
"private": true,
"scripts": {
"buildreact": "cd ./src/vs/workbench/contrib/void/browser/react/ && node build.js && cd ../../../../../../../",
"watchreact": "cd ./src/vs/workbench/contrib/void/browser/react/ && node build.js --watch && cd ../../../../../../../",
"watchreactd": "deemon npm run watchreact",
"test": "echo Please run any of the test scripts from the scripts folder.",
"test-browser": "npx playwright install && node test/unit/browser/index.js",
"test-browser-amd": "npx playwright install && node test/unit/browser/index.amd.js",
@@ -20,7 +26,7 @@
"preinstall": "node build/npm/preinstall.js",
"postinstall": "node build/npm/postinstall.js",
"compile": "node ./node_modules/gulp/bin/gulp.js compile",
"watch": "npm-run-all -lp watch-client watch-extensions",
"watch": "npm-run-all -lp watchreact watch-client watch-extensions",
"watch-amd": "npm-run-all -lp watch-client-amd watch-extensions",
"watchd": "deemon npm run watch",
"watch-webd": "deemon npm run watch-web",
@@ -72,9 +78,15 @@
"update-build-ts-version": "npm install typescript@next && tsc -p ./build/tsconfig.build.json"
},
"dependencies": {
"@anthropic-ai/sdk": "^0.37.0",
"@floating-ui/react": "^0.27.3",
"@google/generative-ai": "^0.21.0",
"@microsoft/1ds-core-js": "^3.2.13",
"@microsoft/1ds-post-js": "^3.2.13",
"@mistralai/mistralai": "^1.4.0",
"@parcel/watcher": "2.1.0",
"@rrweb/record": "^2.0.0-alpha.17",
"@rrweb/types": "^2.0.0-alpha.17",
"@vscode/deviceid": "^0.1.1",
"@vscode/iconv-lite-umd": "0.7.0",
"@vscode/policy-watcher": "^1.1.4",
@@ -85,6 +97,7 @@
"@vscode/sudo-prompt": "9.3.1",
"@vscode/tree-sitter-wasm": "^0.0.4",
"@vscode/vscode-languagedetection": "1.0.21",
"@vscode/webview-ui-toolkit": "^1.4.0",
"@vscode/windows-mutex": "^0.5.0",
"@vscode/windows-process-tree": "^0.6.0",
"@vscode/windows-registry": "^1.1.0",
@@ -96,35 +109,52 @@
"@xterm/addon-webgl": "^0.19.0-beta.64",
"@xterm/headless": "^5.6.0-beta.64",
"@xterm/xterm": "^5.6.0-beta.64",
"ajv": "^8.17.1",
"cross-spawn": "^7.0.6",
"diff": "^7.0.0",
"groq-sdk": "^0.9.0",
"http-proxy-agent": "^7.0.0",
"https-proxy-agent": "^7.0.2",
"jschardet": "3.1.3",
"kerberos": "2.1.1",
"lucide-react": "^0.460.0",
"minimist": "^1.2.6",
"native-is-elevated": "0.7.0",
"native-keymap": "^3.3.5",
"native-watchdog": "^1.4.1",
"node-pty": "1.1.0-beta21",
"ollama": "^0.5.11",
"open": "^8.4.2",
"openai": "^4.85.4",
"posthog-node": "^4.3.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-syntax-highlighter": "^15.6.1",
"tas-client-umd": "0.2.0",
"v8-inspect-profiler": "^0.1.1",
"vscode-oniguruma": "1.7.0",
"vscode-regexpp": "^3.1.0",
"vscode-textmate": "9.1.0",
"yauzl": "^3.0.0",
"yazl": "^2.4.3"
"yazl": "^2.4.3",
"zod": "^3.24.1"
},
"devDependencies": {
"@playwright/test": "^1.46.1",
"@swc/core": "1.3.62",
"@types/cookie": "^0.3.3",
"@types/debug": "^4.1.5",
"@types/diff": "^6.0.0",
"@types/eslint": "^9.6.1",
"@types/gulp-svgmin": "^1.2.1",
"@types/http-proxy-agent": "^2.0.1",
"@types/kerberos": "^1.1.2",
"@types/minimist": "^1.2.1",
"@types/mocha": "^9.1.1",
"@types/node": "20.x",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/react-syntax-highlighter": "^15.5.13",
"@types/sinon": "^10.0.2",
"@types/sinon-test": "^2.4.2",
"@types/trusted-types": "^1.0.6",
@@ -190,6 +220,7 @@
"istanbul-lib-source-maps": "^4.0.1",
"istanbul-reports": "^3.1.5",
"lazy.js": "^0.4.2",
"marked": "^15.0.0",
"merge-options": "^1.0.1",
"mime": "^1.4.1",
"minimatch": "^3.0.4",
@@ -197,6 +228,8 @@
"mocha": "^10.2.0",
"mocha-junit-reporter": "^2.2.1",
"mocha-multi-reporters": "^1.5.1",
"next": "^15.1.4",
"nodemon": "^3.1.9",
"npm-run-all": "^4.1.5",
"opn": "^6.0.0",
"original-fs": "^1.2.0",
@@ -207,16 +240,19 @@
"postcss-nesting": "^12.0.2",
"pump": "^1.0.1",
"rcedit": "^1.1.0",
"rimraf": "^2.2.8",
"rimraf": "^2.7.1",
"scope-tailwind": "^1.0.5",
"sinon": "^12.0.1",
"sinon-test": "^3.1.3",
"source-map": "0.6.1",
"source-map-support": "^0.3.2",
"style-loader": "^3.3.2",
"tailwindcss": "^3.4.14",
"ts-loader": "^9.4.2",
"ts-node": "^10.9.1",
"tsec": "0.2.7",
"tslib": "^2.6.3",
"tsup": "^8.3.5",
"typescript": "^5.7.0-dev.20240903",
"util": "^0.12.4",
"webpack": "^5.94.0",
+28 -74
View File
@@ -1,84 +1,38 @@
{
"nameShort": "Void",
"nameLong": "Void",
"applicationName": "code-oss",
"dataFolderName": ".vscode-oss",
"win32MutexName": "vscodeoss",
"applicationName": "void",
"dataFolderName": ".void-editor",
"win32MutexName": "voideditor",
"licenseName": "MIT",
"licenseUrl": "https://github.com/microsoft/vscode/blob/main/LICENSE.txt",
"serverLicenseUrl": "https://github.com/microsoft/vscode/blob/main/LICENSE.txt",
"licenseUrl": "https://github.com/voideditor/void/blob/main/LICENSE.txt",
"serverLicenseUrl": "https://github.com/voideditor/void/blob/main/LICENSE.txt",
"serverGreeting": [],
"serverLicense": [],
"serverLicensePrompt": "",
"serverApplicationName": "code-server-oss",
"serverDataFolderName": ".vscode-server-oss",
"tunnelApplicationName": "code-tunnel-oss",
"win32DirName": "Microsoft Code OSS",
"win32NameVersion": "Microsoft Code OSS",
"win32RegValueName": "CodeOSS",
"win32x64AppId": "{{D77B7E06-80BA-4137-BCF4-654B95CCEBC5}",
"win32arm64AppId": "{{D1ACE434-89C5-48D1-88D3-E2991DF85475}",
"win32x64UserAppId": "{{CC6B787D-37A0-49E8-AE24-8559A032BE0C}",
"win32arm64UserAppId": "{{3AEBF0C8-F733-4AD4-BADE-FDB816D53D7B}",
"win32AppUserModelId": "Microsoft.CodeOSS",
"win32ShellNameShort": "C&ode - OSS",
"win32TunnelServiceMutex": "vscodeoss-tunnelservice",
"win32TunnelMutex": "vscodeoss-tunnel",
"darwinBundleIdentifier": "com.visualstudio.code.oss",
"linuxIconName": "code-oss",
"serverApplicationName": "void-server",
"serverDataFolderName": ".void-server",
"tunnelApplicationName": "void-tunnel",
"win32DirName": "Void",
"win32NameVersion": "Void",
"win32RegValueName": "VoidEditor",
"win32x64AppId": "{{9D394D01-1728-45A7-B997-A6C82C5452C3}",
"win32arm64AppId": "{{0668DD58-2BDE-4101-8CDA-40252DF8875D}",
"win32x64UserAppId": "{{8BED5DC1-6C55-46E6-9FE6-18F7E6F7C7F1}",
"win32arm64UserAppId": "{{F6C87466-BC82-4A8F-B0FF-18CA366BA4D8}",
"win32AppUserModelId": "Void.Editor",
"win32ShellNameShort": "V&oid",
"win32TunnelServiceMutex": "void-tunnelservice",
"win32TunnelMutex": "void-tunnel",
"darwinBundleIdentifier": "com.voideditor.code",
"linuxIconName": "void-editor",
"licenseFileName": "LICENSE.txt",
"reportIssueUrl": "https://github.com/microsoft/vscode/issues/new",
"reportIssueUrl": "https://github.com/voideditor/void/issues/new",
"nodejsRepository": "https://nodejs.org",
"urlProtocol": "code-oss",
"webviewContentExternalBaseUrlTemplate": "https://{{uuid}}.vscode-cdn.net/insider/ef65ac1ba57f57f2a3961bfe94aa20481caca4c6/out/vs/workbench/contrib/webview/browser/pre/",
"builtInExtensions": [
{
"name": "ms-vscode.js-debug-companion",
"version": "1.1.3",
"sha256": "7380a890787452f14b2db7835dfa94de538caf358ebc263f9d46dd68ac52de93",
"repo": "https://github.com/microsoft/vscode-js-debug-companion",
"metadata": {
"id": "99cb0b7f-7354-4278-b8da-6cc79972169d",
"publisherId": {
"publisherId": "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",
"publisherName": "ms-vscode",
"displayName": "Microsoft",
"flags": "verified"
},
"publisherDisplayName": "Microsoft"
}
},
{
"name": "ms-vscode.js-debug",
"version": "1.93.0",
"sha256": "9339cb8e6b77f554df54d79e71f533279cb76b0f9b04c207f633bfd507442b6a",
"repo": "https://github.com/microsoft/vscode-js-debug",
"metadata": {
"id": "25629058-ddac-4e17-abba-74678e126c5d",
"publisherId": {
"publisherId": "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",
"publisherName": "ms-vscode",
"displayName": "Microsoft",
"flags": "verified"
},
"publisherDisplayName": "Microsoft"
}
},
{
"name": "ms-vscode.vscode-js-profile-table",
"version": "1.0.9",
"sha256": "3b62ee4276a2bbea3fe230f94b1d5edd915b05966090ea56f882e1e0ab53e1a6",
"repo": "https://github.com/microsoft/vscode-js-profile-visualizer",
"metadata": {
"id": "7e52b41b-71ad-457b-ab7e-0620f1fc4feb",
"publisherId": {
"publisherId": "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",
"publisherName": "ms-vscode",
"displayName": "Microsoft",
"flags": "verified"
},
"publisherDisplayName": "Microsoft"
}
}
]
"urlProtocol": "void-editor",
"extensionsGallery": {
"serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
"itemUrl": "https://marketplace.visualstudio.com/items"
},
"builtInExtensions": []
}
+13
View File
@@ -29,6 +29,7 @@
"@xterm/headless": "^5.6.0-beta.64",
"@xterm/xterm": "^5.6.0-beta.64",
"cookie": "^0.4.0",
"debounced": "1.0.2",
"http-proxy-agent": "^7.0.0",
"https-proxy-agent": "^7.0.2",
"jschardet": "3.1.3",
@@ -37,6 +38,7 @@
"native-watchdog": "^1.4.1",
"node-pty": "1.1.0-beta21",
"tas-client-umd": "0.2.0",
"tslib": "^2.8.1",
"vscode-oniguruma": "1.7.0",
"vscode-regexpp": "^3.1.0",
"vscode-textmate": "9.1.0",
@@ -396,6 +398,12 @@
"node": ">= 0.6"
}
},
"node_modules/debounced": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/debounced/-/debounced-1.0.2.tgz",
"integrity": "sha512-6GPv+l/OOtdb1DKNY70k5ubuJhVjtBjUnujC5vQAHHrMuvBpDXsTc91xEMTdeA3/v4swYHamtdB9XIN7DcKxpw==",
"license": "MIT"
},
"node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@@ -1028,6 +1036,11 @@
"node": ">=8.0"
}
},
"node_modules/tslib": {
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="
},
"node_modules/tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
+2
View File
@@ -26,12 +26,14 @@
"cookie": "^0.4.0",
"http-proxy-agent": "^7.0.0",
"https-proxy-agent": "^7.0.2",
"debounced": "1.0.2",
"jschardet": "3.1.3",
"kerberos": "2.1.1",
"minimist": "^1.2.6",
"native-watchdog": "^1.4.1",
"node-pty": "1.1.0-beta21",
"tas-client-umd": "0.2.0",
"tslib": "^2.8.1",
"vscode-oniguruma": "1.7.0",
"vscode-regexpp": "^3.1.0",
"vscode-textmate": "9.1.0",
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 813 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 254 KiB

Some files were not shown because too many files have changed in this diff Show More