Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a do autocompletion #593

Merged
merged 3 commits into from
Aug 19, 2021
Merged

Conversation

axelson
Copy link
Member

@axelson axelson commented Aug 18, 2021

For some clients typing do will result in autocompletion which is typically not what the developer wants, an example autocompletion is defoverridable. So this PR works around that by adding do as an autocompletion when the exact text entered is "do".

I'm curious if anyone has any better/different ideas on how to solve this.

For some clients typing `do` will result in autocompletion which is
typically not what the developer wants, an example autocompletion is
`defoverridable`. So this PR works around that by adding `do` as an
autocompletion when the exact text entered is `"do"`.
@axelson axelson requested a review from lukaszsamson August 18, 2021 03:31
@brianalexander
Copy link

Talk about a timely issue. Was just going to look this up! defoverridable is the bane of my existence right now.

@lukaszsamson
Copy link
Collaborator

Unfortunately that's one of the cons of fuzzy matching

@nshafer
Copy link

nshafer commented Sep 3, 2021

It would be nice if it also indented, so insert_text: "do\n$0\nend" probably needs to be insert_text: "do\n\t$0\nend"

@axelson axelson deleted the add-completion-of-do branch September 3, 2021 19:00
@axelson
Copy link
Member Author

axelson commented Sep 3, 2021

@nshafer I experimented with that a bit, but correct indentation will depend on how indented the original code is which won't always be a single level. We might be able to add some more smartness in the future but I'm not sure what form that would take.

@nshafer
Copy link

nshafer commented Sep 8, 2021

Ahh, I figured that since the carriage return results in the cursor being on the same line as whatever started the do, I thought just adding one \t would then indent whatever amount the user has configured for that file. I've had this User Snippet for a month or two now, and it seems to work reliably. Of course, it's probably totally different in the language server.

	"do_block": {
		"prefix": "do",
		"body": [
			"do",
			"\t$0",
			"end"
		]
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants