metabase / metabase/metabase

Code autocomplete: automatically add space after keywords

Open
#8,710 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Querying/Native Type:New Feature
Dominant language
Clojure
Stars
49.3k
Forks
6.8k
Avg merge
1d 13h
Merged PRs (30d)
653

Description

# Test case

1. Ask a question
2. SQL
3. Type `sel`
4. Expect autocomplete `select` keyword is an option
5. Press TAB

# Expected outcome

The text `select ` is active in your text editor, including the space after the word select.

# Actual outcome

The text `select` is active in your text editor. You will very likely type SPACE after each time you use this feature.

# Discussion

It is *possible* that the user intends to add a `(` after the `select`, rather than a space, but this is extremely rare.

It is also possible that the user intends to start a new line after autocomplete. Luckily, that situation is easy to correct for:
* If the current line matches `/\s$/` and the user presses RETURN then perform `s/\s$//` before going to the new line.

It is painful to introduce autocorrects that are not what the use intends, perhaps the threshold should be 95% of people want something before an autocorrect is implement. This issue definitely falls into that category.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the SQL editor autocomplete implementation and the keyword completion path described in this issue; the payload names no file or test. Verify the change with the `sel` → `select` → Tab flow and confirm the inserted text includes a trailing space without breaking the stated newline case.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure, sql
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.