smallcloudai / refact-vs-classic Goto Github PK
View Code? Open in Web Editor NEWRefact for Visual Studio is a free, open-source AI code assistant
License: BSD 3-Clause "New" or "Revised" License
Refact for Visual Studio is a free, open-source AI code assistant
License: BSD 3-Clause "New" or "Revised" License
When grey text is displayed, cursor position is not at start of the line.
Before accepted:
After accepted:
When grey text is displayed, frame doesn't fit the text. It could be below the line or under the line. Appears with multiline completion.
Reproduces with approximately 20% probability.
Version:
Microsoft Visual Studio Community 2022 (64-bit) - 17.8.5
Refact plugin - 0.0.2
Try multiline completion.
Press Tab to accept suggestion (grey text).
Wait for next suggestion (grey text) as long as you wish.
Expected result:
Example screens from VS Code:
Perhaps it's because the completion ends with a parenthesis
Version:
Microsoft Visual Studio Community 2022 (64-bit) - 17.8.5
Refact plugin - 0.0.2
Multi line completion -- should happen when the cursor is on a empty string, or on a string with only spaces.
A typical example of multi line completion:
def do_this_thing():
|
User hits Enter, IDE provides auto-indent, and then a function body should appear as grey text.
To implement it, the plugin should check if the line is empty or it has only spaces, then delete all the spaces on the empty line (in memory, not in the editor), and then request the model for completions.
It's important to delete spaces before asking the model, because there should be a way for the model to suggest code with less indent. Typical example of this:
int main()
{
printf("Hello world!\n");
|
Now the completion is "}", but it will not work unless there are no spaces on that line. With spaces, the model is constrained to " }".
Now the single line completion should happen when the current line is not empty, and there is nothing except closing special characters on the right:
let right_of_cursor_has_only_special_chars = Boolean(right_of_cursor.match(/^[:\s\t\n\r(){},."'];]*$/));
If multiline=false
, the model will return only the remainder of the current line, and stop. The plugin needs to replace the line ending in the editor with the new completion given by the model.
If the cursor is not exactly on the last character of the current line, then #6 about how to deal with that case.
The 0.1 version should be just grey text (inline completion), settings, rust LSP server. No chat, toolbox.
Settings: similar to VS Code,
(xDebug is not strictly necessary, if it's convenient for debugging then why not)
Rust backend is easy to build and run like this:
cargo build && target/debug/code-scratchpads --address-url Refact --api-key REFACT_API_KEY --http-port 8001 --lsp-port 8002 --logs-stderr
Also try --help
.
Completions are available via HTTP and LSP (preferred). Later we plan to implement LSP 3.18 that has standardized inline completions.
Cache, telemetry is already implemented in the rust layer.
Grey text should generally behave similar to VS Code (all plugins behave almost the same in VS Code, because it's implemented in the IDE).
A lot of attention needed to polish interaction between gray text and standard VS popups.
It needs to show:
I have cloned and opened the RefactExtension.sln
solution with Visual Studio 2022.
When compiling in Debug | Any CPU
I end up with following error message:
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5229,5): error MSB3030: Could not copy the file "D:\Dev\refact-vs-classic\MultilineGreyText\Resources\refact-lsp.exe" because it was not found.
What did I do wrong?
Refact-lsp process doesn't restart with relevant settings change.
For example,
no error message if you delete api key, close settings, open settings and add new incorrect key;
no error message when change correct url to incorrect;
need to reload IDE when added correct API key
Versions:
Refact plugin: v 0.0.2
Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.9.0
Steps to reproduce:
Open IDE (open file/project or create new)
Wait as much as you want.
Check if status bar is displayed
Expected result:
Actual result:
Try completion (E.g. press space button) and status bar will appear
Version:
Microsoft Visual Studio Community 2022 (64-bit) - 17.8.5
Refact plugin - 0.0.2
Steps to reproduce:
Use completion.
Check logs in ..cache\refact\logs.
Expected result:
Logs are written.
Actual result:
There are no logs.
Software versions:
Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.8.4
Refact plugin v 0.0.1
Windows 11 Pro 22H2 22621.2861
Cursor is not at the end of the line, but behind some special characters (regex) like closing parenthesis: "def f(x: stri|):", completion should give "ng):" and replace the rest or the string.
From VS Code the regex is:
let right_of_cursor_has_only_special_chars = Boolean(right_of_cursor.match(/^[:\s\t\n\r(){},."'];]*$/));
The other keyword is "multiline=False", the model switches to a special mode to replace the rest of the current string.
Steps to reproduce:
Create new file, for example, .cpp.
Use completion.
Restart IDE.
Create new file
Try to use completion.
Expected result:
Refact plugin works.
Actual result:
Completion doesn't work because process refact-lsp did not complete from the previous launch.
Sometimes another reboot may be necessary to reproduce the problem.
Software versions:
Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.8.4
Refact plugin v 0.0.1
Windows 11 Pro 22H2 22621.2861
Logs:
ActivityLog.zip
Default shortcut: alt + shift + /
Like AI assistant and another
Enable option "Telemetry Code Snippets", then use completion. After closing IDE there is no telemetry files in user/.cache/refact/telemetry/
Versions:
Refact plugin: v 0.0.2
Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.9.0
For this plugin to be useful, we need these fixes (in order of importance):
#9 (especially the part where you hit Enter and there's no code completion)
#14
#6
And these enhancements:
#8
#15
also follow any changes in VS Code settings, they are soon to change a bit
also find good places to place a link to Refact discord, a link to issues in this repo (examples of good places: click on status bar, settings)
Another plugins have status bar with status of plugin
I added "AAA1" and "AAA2" around the call, only "AAA1" is visible in the logs.
On the screenshot is my attempt to reproduce this again, right after merging #10 .
Windows 11
Debug build from source
refact-lsp
downloaded from https://github.com/smallcloudai/refact-lsp/actions/runs/7289748072
dist-x86_64-pc-windows-msvc
Steps to reproduce:
Add at least one space character on line
Try completion from start of line
Expected result:
IDE and completion working
Actual result:
After entering several characters and space character IDE crashes
https://github.com/smallcloudai/refact-vs-classic/assets/140423660/f86eb6a4-937d-410e-a573-61923159de30
Software versions:
Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.8.4
Refact plugin v 0.0.1 https://github.com/smallcloudai/refact-vs-classic/actions/runs/7469728225?pr=22
Windows 11 Pro 22H2 22621.2861
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.