#StackBounty: #shell #zsh #autocomplete zsh completion: do not offer directories when extracting archive with tar

Bounty: 200

the completion system for tar command is quite clever. When I have different archive types, it offers the relevant files depending on tar options used:

$ ls
file.tar.xz
file.tar.gz

$ tar xJf f<TAB>
file.tar.xz

$ tar xzf f<TAB>
file.tar.gz

It recognizes xJf as acting on tar.xz files, and xzf acting on tar.gz files.

But when directory exists in current location, it offers it for completion as well :

$ tar xJf f<TAB>
foo/   file.tar.xz

Can I tell the completion system, that I only want to complete files, when extracting archives (ie, tar option x...) ?

But it should still offer directories when creating archives (tar option c...):

tar cpJf foo.tar.xz 

I assume this will need modifying the main completion file for tar command: /usr/share/zsh/functions/Completion/Unix/_tar. But how?


Get this bounty!!!

#StackBounty: #bash #autocomplete #options Bash how does skip-completed-text work?

Bounty: 50

I use menu-complete bash function to cycle through completion when I press Tab, and I’m happy with it. But the following has too often happened to me.

Suppose I’m looking for the file longparthardtoremember.with.QQQQQQQ.extension in a directory which contains the files

longparthardtoremember.with.AAAAAAA.nice.long.extension
longparthardtoremember.with.BBBBBBB.very.nice.long.extension
...

If I Tab-complete $ long the first filename will be inserted. At that point, I’d like to move to the middle of the filename, delete the AAAAAAA part, type B, and then Tab-complete again. If I do so, all the part after BBBBBBB is inserted as well, thus leading to a duplication of it, which I obviously don’t want.

With vi editing mode, I’m quite quick in dealing with this (I quickly move to the repeated part and delete it), but it is still annoying.

By pure chance I’ve find the skip-completed-text bash option in bash’s man page. Isn’t this what I need? I’ve set it on, but I can’t see any difference in the behavior of in-middle-of-work Tab-completion. Have I misunderstood the man page?


Get this bounty!!!

#StackBounty: #bash #wildcards #autocomplete bash inputrc autocompletion with wildcards

Bounty: 200

I’ve adapted my inputrc with the following:

#Use tab to cycle through all the possible completions.
"t": menu-complete
"e[Z": menu-complete-backward

and when I have the following directory of server logs:

ATWIEUNXSRVFILE001
ATWIEWINSRVDOMA001
USLAXUNXSRVFILE001
USLAXWINSRVFILE001

I’d like autocompletion to cycle through all FILE servers. I.E.

$ analyze_logs *FILE*Tab

should cycle through

ATWIEUNXSRVFILE001
USLAXUNXSRVFILE001
USLAXWINSRVFILE001

(Where * obviously is some kind of wildcard/regex/anything, really…)

  • This has been bugging me for a few years already
  • I do have a few workarounds like
    • Alt+*
    • ls *FILE* > serverlist.txt
    • set show-all-if-ambiguous on
  • My google-fu seems to be abandoning me as I can’t find anything that does what I want.

If it helps, I’m definitely running bash (echo $0/bin/bash), on an arch-derivative but, if possible would like something portable across multiple *nix systems.


Get this bounty!!!

#StackBounty: #reactjs #autocomplete #material-ui #autofill Chrome, Edge – Disable autofill / autocomplete for fields

Bounty: 200

I have a ReactJS app that is built with Material UI.

The target browsers are Chrome and Microsoft Edge, both latest version and two latest versions (so in total 3 versions).

What I want to achieve:

Disable the autocomplete and autofill for textinput fields.

I have searched for a long time but could not find a working solution.

What I have tried so far:

  1. autoComplete={"off"}
  2. autoComplete={"false"}
  3. autoComplete={"xyz"} so Autocomplete with a custom value
  4. autoComplete="new-password"> but it does not work in Edge
  5. Implementation of a solution, that adds HTML readonly attribute to each input field at the beginning, removes it on focus and adds it again onBlur of the texfield. This does not work and moreover leads to a defect that moving to another text input by using tabulator on the keyboard is not possible any more.

It is no solution for me, to wrap every field in a <form> element.

Happy to see an approach to solve this.


Get this bounty!!!

#StackBounty: #bash #shell #zsh #autocomplete How does Bash/Zsh identify the relevant command during completion?

Bounty: 50

When I start typing something into an interactive login shell (zsh or bash) and click tab, the shell offers me autocomplete suggestions.

I broadly understand how completion specs are defined. For reference it’s outlined here:

What I don’t understand is how bash/zsh identify which command to complete on when a user presses tab i.e. if I do ls [tab], how does bash/zsh identify ls. Put differently, how do bash/zsh know to generate completions using the ls completion spec.

Some more examples with more complicated parsing which Bash/Zsh still get right:

  • ls [tab] -> completes on ls
  • echo $( echo $(ls [tab] -> completes on ls
  • echo hi; git a[tab] -> completes on git
  • echo 'cd [tab] -> does NOT complete on cd
  • echo "$(ls [tab] -> completes on ls
  • echo $( echo hi | ls [tab] -> completes on ls
    (I know ls doesn’t take stdin but this example still illustrates bash/zsh’s parsing abilities)

I am presuming bash/zsh are using some sort of parser. However, it’s not a normal parser. It completes without a properly structured command. It is aware that something is in quotes or a shell expansion, even if they are not closed.

What function is bash/zsh running to "identify" the relevant command or determine whether or not there is a command to complete on at all?


Get this bounty!!!

#StackBounty: #python #autocomplete #attributes Is it possible to have Python IDEs offer autocompletion for dynamically generated class…

Bounty: 200

Are there any tricks I can employ to get IDEs to offer code completion for dynamically generated class attributes? For instance


class A:
    
    def __init__(self):
        setattr(self, "a", 5)

This code will set the class attribute of A called a to the value of 5. But IDEs do not know about a and therefore you do not get code completion for it. I’ve read that the __dir__ method can be hooked, but the suggestion made in that answer has not worked for me. Does anybody have any ideas?


Get this bounty!!!

#StackBounty: #python #python-3.x #machine-learning #autocomplete #artificial-intelligence Is there a way to reset Kite Autocomplete&#3…

Bounty: 50

I’m wondering if I can reset the training of Kite’s AI that uses my code. I want to do this because I want to change my code style and there is some stuff that I quit doing.

Take xrange for example; it’s deprecated in python3 (I’m a python coder). So, I want to reset all of the data it learned from me as if I just got it again. I don’t want to uninstall and reinstall it.

Is uninstalling the Sublime Text/Atom plugins and reinstalling them would do the trick? Or is it not possible?

And for the specs, I got a MacOS Catalina (10.15.5 (19F96)), non-pro and no account for Kite, and Kite version 0.20200609.2.

I really want to know if there’s an official way, not some file removing magic.

But if some file removing magic is necessary, then I’m fine.

Also, I wonder if just removing and reinstalling the plugins for editors would do the trick…


Someone set a bounty on this; I don’t wanna.


Get this bounty!!!

#StackBounty: #zsh #autocomplete #tab-completion #globbing How do I get zsh tab completion to "vi **/foo<TAB>" to match…

Bounty: 150

How do I get zsh tab completion to cat **/foo<TAB> to match and complete the first file matching foo* in any subdirectory under the current directory?

For example, do this while inside a fresh test directory: (again, this is zsh)

% mkdir aaa bbb ccc
% touch aaa/foo bbb/foo ccc/foo
% cat **/f<TAB>

What I want when I hit <TAB> on that last line is for my screen to end up looking like this:

% cat aaa/foo_                 # filled in the first match; "_" is the cursor
aaa/foo  bbb/foo  ccc/foo      # and here is the list of all matches

I tried setopt GLOB_COMPLETE, but that didn’t do what I wanted.


Get this bounty!!!

#StackBounty: #django #autocomplete Autocomplete does nothing. What is wrong?

Bounty: 50

I have autocomplete code which does not work.

I have input field class Coordinate where when i type code it finds value from my DB that matches with geo_code and hence finds the input code country.

So when i type UK it matches with geo_code and then matches the last with the country so in this case UK is code i type it can be found in geo_code and country is United Kingdom. The code works, what i want to achieve is bring autocomplete to give suggestions while typing:

for examples: when i type U the field to bring suggestions in this format:

UK   United Kingdom
USA  United States of America

What i did so far:

In models.py i have:

class Coordinate(models.Model):
    code = models.CharField(max_length=150)

class Profiles(models.Model):
    geocode=models.CharField(max_length=200)
    country=models.CharField(max_length=500)

    class Meta:
        managed=False
        db_table='profiles_country'

    def __str__(self):
        return '{}'.format(self.geocode)

in forms.py:

from dal import autocomplete

class CoordinateForm(forms.ModelForm):
    code= forms.CharField(max_length=150, label='',widget= forms.TextInput)

    class Meta:
        model = Coordinate
        fields = ('__all__')
        widgets = {
            'code': autocomplete.ModelSelect2(url='coordinate-autocomplete',
            attrs={ 'theme': 'bootstrap'})}

    def clean_code(self):
            code=self.cleaned_data.get("code")
            if not Profiles.objects.filter(geocode=code).exists():
                raise forms.ValidationError ( "Not true")
            return code

in views.py:

from dal import autocomplete

def geoview(request):
    form = CoordinateForm(request.POST or None)
    if request.method == "POST":
        if form.is_valid():
            form1 = form.save(commit=False)
            code = form1.code
            dataview=Profiles.objects.get(geocode=code)

            context={'geodata':dataview ,}

            return render(request, 'cgeo/result.html', context)

    return render(request, 'cgeo/search.html', context={'form':form})


class CoordinateAutocomplete(autocomplete.Select2QuerySetView):
        def get_queryset(self):
            if not self.request.user.is_authenticated():
                return Profiles.objects.none()
            qs = Profiles.objects.all()
            if self.q:
                qs = qs.filter(name__istartswith=self.q)
            return qs

in main urls.py:

urlpatterns = [
    path('admin/', admin.site.urls),
    path('geo/', geoview, name='geo'),
    path('coordinate-autocomplete/', CoordinateAutocomplete.as_view(create_field='name'), name='coordinate-autocomplete'),]

in base.html

<!DOCTYPE html>
{% load static %}

<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">

    <link rel="stylesheet" href="{% static 'geoproj/css/main.css' %}">

  </head>
  <body>

    <div>{% block content %}{% endblock  %} 

         {% block javascripts %} {% endblock %} </div>

  </body>
</html>

in geo.html :

{% extends "base.html" %}
{% block content %}

{% if user.is_authenticated %}
            <form enctype="multipart/form-data" method="POST" >
                    {% csrf_token %}
                    {{ form}}
                    {{form.media }}
            <button class = "btn btn-primary" type="submit">OK</button></form>


{% endif %}

{% endblock content %}

{% block javascripts %} {% endblock %}

I don’t know where exactly is the problem. What excat js links to put as different sources put different links of js and still does not work for me.

I would appreciate you help to solve this case.


Get this bounty!!!

#StackBounty: #linux #ubuntu #autocomplete TextSuggest autocomplete error on Ubuntu 18.04.3

Bounty: 50

I’m having an issue with TextSuggest – an automcomplete tool for Linux. It only works once, after that the shortcut doesn’t open the autocomplete popup anymore. (nothing happens at all)

  • My Shortcut: SHIFT+CTRL+P
  • OS: Ubuntu 18.04.3 LTS.
  • I added textsuggest-server in the background to run on startup

Error message after I select a word from the TextSuggest menu and press enter:

    go@tom:~/Desktop/TextSuggest-Pkg$ textsuggest-server
Started server at org.textsuggest.server, PID: 7678…
time get_all_words([English, English]) = 0.001719
Processing 'previous'
    Using processor 'command' from '/usr/share/textsuggest/processors/command'
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr: __pos (which is 18446744073709551615) > this->size() (which is 0)
/usr/bin/textsuggest-server: line 3:  7678 Aborted                 (core dumped) LD_LIBRARY_PATH=/usr/share/textsuggest/libs /usr/share/textsuggest/textsuggest-server "$@"

error 2:
Started server at org.textsuggest.server, PID: 7811…
time get_all_words([English, English]) = 0.00155287
time get_all_words([English, English]) = 0.00150532
Processing 'previous'
    Using processor 'command' from '/usr/share/textsuggest/processors/command'
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr: __pos (which is 18446744073709551615) > this->size() (which is 0)
/usr/bin/textsuggest-server: line 3:  7811 Aborted                 (core dumped) LD_LIBRARY_PATH=/usr/share/textsuggest/libs /usr/share/textsuggest/textsuggest-server "$@"

Any ideas what could be the issue?


Get this bounty!!!