edubkendo / atom-racer

Intelligent code completion for Rust in the Atom Editor. Requires Racer.
MIT License
115 stars 24 forks source link

completion after semicolon #75

Open Zolmeister opened 7 years ago

Zolmeister commented 7 years ago

While typing code, after the last ; (semicolon) a new completion shows up (first entry Trait AsMut), which is undesired.

Atom: v1.12.0-dev-44c0fe5

// e.g.
let mut t = String::new();
johalun commented 7 years ago

Same problem. Always completes after only one letter and after semi colon. Does not respect "minimum word length" set in autocomplete-plus package settings.

Would be very grateful for an update to fix this.

zhuanhao-wu commented 7 years ago

Hi there, there could be a hotfix. edit ~/.atom/packages/racer/lib/racer-provider.coffee, after line 189 from

  findSuggestionsForPrefix: (prefix, completions) ->
    if completions?.length
      # Sort the candidates
      words = _.sortBy( completions, (e) => e.word )

to

  findSuggestionsForPrefix: (prefix, completions) ->
    if prefix.slice(-1).match(/;/g)
      return []
    if completions?.length
      # Sort the candidates
      words = _.sortBy( completions, (e) => e.word )

not sure if this is the proper way to break completion, but this do work.