Pluto.jl: TAB-completion inside a string (inside quotes) is different from normal

Created on 26 Nov 2020  路  9Comments  路  Source: fonsp/Pluto.jl

When writing a string, e.g. with the cursor where the star is in md"my_text* ", the autocompletion is different compared to when not in a string. When trying to autocomplete \omega to get the greek symbol, it is autocompleted to \Documents and Settings\\.

This is annoying in general, but especially when defining a unit like Ohm. I then have to close the string macro with an extra ", write \Omega<TAB>, and erase the extra ". It is not a major problem at all, but annoying. Anyone else experiencing this, and does anyone know of a way to fix it?

All 9 comments

Thank you for the report!

This is supposed to be a 'feature' of Julia: autocompleting paths inside strings, but I'm not sure that I agree with this feature. Especially because (in the future) I want to motivate authors to write notebooks that are standalone, i.e. do not depend on local files.

@aviatesk What do you think? Can/Should we disable path autocomplete inside strings?

FYI it's designed for this situation:

my_text = read("em<TAB>

will autocomplete to

my_text = read("emma.txt

Can/Should we disable path autocomplete inside strings?

you can filter our path completions:
https://github.com/fonsp/Pluto.jl/blob/9bea6ea7418fbf6e73ae8e7b5da21b751f450dc3/src/runner/PlutoRunner.jl#L684-L690
with something like

filter!(!Base.Fix2(isa, FuzzyCompletions.PathCompletion), result)

And query parameter there allows further fine tunings like filtering path completions only within string-macro scope, etc:

# suppress path completions only within string-macro scope
x = Meta.parse(query)
if isa(x, Expr) && x.head === :macrocall
     filter!(!Base.Fix2(isa, FuzzyCompletions.PathCompletion), result)
end

Well, I'm not sure if we _should_ disable path completions or not. Even within a notebook context, it's sometimes useful imho e.g. when we want to load local CSV data when using Pluto in a data science context.

I then have to close the string macro with an extra ", write Omega, and erase the extra "

Well, separate from the path completion discussion, FuzzyCompletions somehow doesn't seem to provide latex completions within a string scope. I will dug into this this weekend or so.

I then have to close the string macro with an extra ", write Omega, and erase the extra "

Well, separate from the path completion discussion, FuzzyCompletions somehow doesn't seem to provide latex completions within a string scope. I will dug into this this weekend or so.

Amazing, thanks a lot <3. This package and team are amazing - I have recently swiched to Pluto as my main IDE/place to do programming ^_^

[email protected] will fix this issue.

Can you make a PR? Is there a breaking change?

Nothing breaking, but here is: https://github.com/fonsp/Pluto.jl/pull/727

Thanks! Next time, you could register it as a patch (0.4.0 -> 0.4.1) instead of a breaking release (0.4.0 -> 0.5.0). This means that Atom and Pluto get the latest FuzzyCompletion features without doing anything :)

I hesitated to do patch release and silently fix this issue , but yeah, it certainly doesn't follow the semantic versioning..

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fonsp picture fonsp  路  4Comments

briochemc picture briochemc  路  6Comments

garrison picture garrison  路  4Comments

karlwessel picture karlwessel  路  4Comments

mossr picture mossr  路  6Comments