autocomplete-paths icon indicating copy to clipboard operation
autocomplete-paths copied to clipboard

Allow completions for arbitrary strings

Open marcoms opened this issue 7 years ago • 8 comments

There are many use cases where path completions are desired which are not in require/import statements, e.g.

@Component({
  ...
  templateUrl: './please-complete-me.html',
})

Allowing completions in the above case and others would be very useful. Depending on the performance impact it could be enabled/disabled through an option.

marcoms avatar Aug 19 '17 17:08 marcoms

That would mean that autocomplete-paths would trigger every time you create a string, which would be very annoying. We would need more specific rules for this.

Happy to hear your thoughts and merge a PR that provides this feature

saschagehlich avatar Aug 23 '17 12:08 saschagehlich

I was thinking closer to VSCode's behavior, which starts path completion when there is a slash, instead of on an empty string. You are right that triggering on any string would be annoying, so perhaps the above approach would make more sense, as it would be much more likely the user wants path completion when typing './ or '/

marcoms avatar Aug 23 '17 12:08 marcoms

As for me, I would like to have a functionality to manually open autosuggestions by hotkey.

Alexance avatar Aug 24 '17 14:08 Alexance

Autosuggestion by hotkey makes more sense imho, because you don't always want suggestions when typing / or ./. Not sure if this is possible though - would have to investigate.

@joefitzgerald Is it possible to only provide suggestions when a hotkey is pressed? How would one go about implementing this?

saschagehlich avatar Aug 24 '17 14:08 saschagehlich

Forgive me if I'm wrong, but wasn't that the previous behavior? I would love for a toggle to reenable that.

Edit: "that" meaning enabling the autocompletion when the string looks like a path (ie / or ./)

jacobmischka avatar Aug 31 '17 19:08 jacobmischka

Correct, that was the previous behavior. autocomplete-paths 2.0 is a complete rewrite though, so simply re-enabling it doesn't work.

saschagehlich avatar Sep 01 '17 08:09 saschagehlich

I didn't mean simply re-enabling it, I just meant I like the behavior and would like if it were possible again rather than using a hotkey.

But I think I'll use a fork of 1.0 of this package in addition to the current version of this one, so that I can use this package which is undoubtedly better in a scope but occasionally also autocomplete arbitrary paths.

Thanks!

jacobmischka avatar Sep 01 '17 11:09 jacobmischka

If the auto-completion only triggers when typing / inside a quoted string, I think it would be acceptable. autocomplete-plus has a selector option which might help with implementing this. It probably shouldn't be used width the prefixes though.

hagabaka avatar Oct 11 '17 21:10 hagabaka