Giter Club home page Giter Club logo

Comments (6)

mscolnick avatar mscolnick commented on September 27, 2024

I think this is more of a feature request - as I can see both being preferences.

Do you use a formatter? Does your formatter handle this (or undo this)?

from marimo.

mscolnick avatar mscolnick commented on September 27, 2024

Actually this might be a bug - seems like the tab logic is being intercepted by:

const startCompletionAtEndOfLine = (cm: EditorView): boolean => {
const { from, to } = cm.state.selection.main;
if (from !== to) {
// this is a selection
return false;
}
const line = cm.state.doc.lineAt(to);
return line.text.slice(0, to - line.from).trim() === ""
? // in the whitespace prefix of a line
false
: startCompletion(cm);
};

cc @akshayka

from marimo.

akshayka avatar akshayka commented on September 27, 2024

Is a completion accidentally being triggered?

EDIT: okay I think I understand. I can take a look.

from marimo.

mscolnick avatar mscolnick commented on September 27, 2024

@jydiw - there was a bug in the existing code, which i have fixed here: #2394

The logic is still:

  • if you are at the end of the line, it will try to open the autocomplete
  • if you are in the beginning or middle, it will insert 4 spaces.

Is this ok for your use-case? If you are trying to insert the tab/spaces between you code and an inline-comment, this would work. But if you are trying to add a tab at the end of the line, this won't solve that case. Do you still hope for this to be configurable for that case?

from marimo.

mscolnick avatar mscolnick commented on September 27, 2024

Sorry @jydiw - scratch what I saw. I think we plan on keeping Tab as completion anywhere in the line (not just the end). So we can keep this as a FR to make it configurable.

from marimo.

jydiw avatar jydiw commented on September 27, 2024

I am coming from VSCode so perhaps this request is only because of what I am used to. Its behavior is slightly different than what you describe:

  • If you are at the beginning of a line, it will insert {tabwidth} spaces.
  • If you are anywhere else, it will insert however many spaces needed to get to the nearest multiple of {tabwidth}.
# if i type this sentence   < tab inserts to here
# and if i type this one    < tab also inserts to here

from marimo.

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.