Giter Site home page Giter Site logo

Comments (4)

rjmacarthy avatar rjmacarthy commented on May 23, 2024

Hey thanks for the suggestion this is a good idea.

To be honest I am not sure how these small models handle FIM for multiple languages in the same prompt, probably not well is my assumption.

It might be easier in the chat as we can have a drop down as you mention. In terms of detecting the current language from the editor, I am not sure what the best approach would be currently it might require more advanced techniques to establish it.

from twinny.

brunoais avatar brunoais commented on May 23, 2024

To be honest I am not sure how these small models handle FIM for multiple languages in the same prompt, probably not well is my assumption.

They aren't good with multiple languages in the same place but usually it's not required to have a lot of content outside the small area to get suggestions so usually it can adapt to the situation because (mostly) all it will see is that singular embedded language's code (E.g. javascript in an HTML document) or it's so small the help isn't useful.

It might be easier in the chat as we can have a drop down as you mention.

Yep. That's what I recommend too. Maybe with some kinks to make it fast to swap out, for example, fast tabbing or a shortcut only available in that window to open the dropdown.
For now, I'd just have a hardcoded list of languages for each defined language and accept PRs to make them more complete. For example, for PHP:

  1. PHP
  2. HTML
  3. Javascript
  4. CSS

The order is designed to make the most likely language to encounter in each language mode. In PHP, PHP should be the most common. Followed by HTML (because JS and CSS, most likely will be in external files). Then I went with js just because non-AI has gotten really good with CSS, so js is most likely to be asked about.

For other file types, for example, HTML, would be the 2,3,4 of the previous list.

A very different example: jinja2. Would probably get the same set as PHP except the 1st one is jinja2 or just straight up move the jinja2 to 2nd and select HTML 1st instead (Maybe leave the jinja2 help to the non-AI... Not sure. Dunno how good the AI is with jinja2).

There's a lot that would be correct so I'd start with some languages that are "multi-language" and hardcode possibilities for the drop down. After ppl start using this more, maybe someone will have good ideas how to proceed to viably please people.

For automatic detection... I'd probably start with half-arsed regex or similar to figure out some identifiers but I wouldn't try yet. It's full of issues and annoying (to the user) edge-cases that are not worthwhile yet.


For implementation, I'd just have a very simple translation table (can be a js object) from a name and an array of options for the drop box. If not defined in the translation table, just use the language provided.

For now, I'd be happy with:

  1. PHP
  2. HTML
  3. jinja-py

There might be more and ppl with other embeds but this should work fine for now.
What do you think?

from twinny.

AntonKrug avatar AntonKrug commented on May 23, 2024

I'm unable to find viable alternatives.

You could make your own buttons for each language being hardcoded. Explain JS, Explain HTML and enable/disable the ones you do not want at that specific moment so it's not clutering the buttons too much. And you use these dedicated buttons to request explanation from whitin that given language instead of having one generic button like now:

{{{systemMessage}}}
Explain the following code;
{{{code}}}
Do not waffle on. The language is:
{{language}}

from twinny.

rjmacarthy avatar rjmacarthy commented on May 23, 2024

stale

from twinny.

Related Issues (20)

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.