GithubHelp home page GithubHelp logo

smallcloudai / refact-vs-classic Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 9.0 13.48 MB

Refact for Visual Studio is a free, open-source AI code assistant

License: BSD 3-Clause "New" or "Revised" License

C# 100.00%

refact-vs-classic's People

Contributors

digital-phoenix avatar olegklimov avatar reymondzzzz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

refact-vs-classic's Issues

Grey text render problems

  • 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

After token limit, the next portion doesn't start automatically after hitting Tab

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:
изображение
изображение

Actual result
изображение
изображение

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

[VS Classic] Distinguish multiline and single line completions

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.

[bounty] Version 0.1

The 0.1 version should be just grey text (inline completion), settings, rust LSP server. No chat, toolbox.

Settings: similar to VS Code,

image

(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.

[VS Classic] Implement status bar

It needs to show:

  • "|{ Refact" when idle
  • rotating icon of some sort when it's thinking about the new completion
  • contrast background and "unplugged" icon when error, tooltip should show what the error was

Error when compiling plugin

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

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

Status bar is not displayed after loading until completion is used

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

Rustbinary logs are not written

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

Completion -- when not exactly at the end of the line

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.

image

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.

Can't restart refact-lsp in some cases

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:
Снимок экрана 2024-01-09 100917
Снимок экрана 2024-01-09 101623
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

Version v0.2

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)

Add status bar

Another plugins have status bar with status of plugin

IDE crashes if trying completion when cursor is on a string with space in front of it

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

Logs:
rustbinary.zip
ActivityLog.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.