Sublime Forum

SQL: Completions does not suggest word on same line

#1

Database schemas I use give columns the same name if they’re meant to be used in a join, but Sublime Text is refusing to offer me word completions for the column name on the same line in this circumstance:

SELECT * FROM bar
JOIN foo
ON bar.bar_id = foo.bar

it does not offer bar_id as a completion, only bar. It does, however, if the whole statement is on one line:

SELECT * FROM bar JOIN foo ON bar.bar_id = foo.bar_id

Any pointers to where I can look to fix this?

1 Like

#2

Iirc, if a token only appears one time, it won’t be used in completion list.

0 Likes

#3

But it does work when the statement is all on one line, so I don’t think that can be the issue?

0 Likes

#4

Interesting! But then :man_shrugging:

1 Like

#5

I had the idea that maybe there’s a tmPreferences file somehow affecting it, but I had a quick look and didn’t see anything. And we don’t have any settings which could control what scopes get picked up for completions or anything, so it’s not that. (https://github.com/sublimehq/sublime_text/issues/3643)
I’m not convinced it’s something we can fix, we might need SublimeHQ to investigate and explain what’s going on. This bug looks related:
https://github.com/sublimehq/sublime_text/issues/5756

0 Likes