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

Snippet suggestion triggered incorrectly #6320

Closed
23min opened this issue May 12, 2016 · 8 comments
Closed

Snippet suggestion triggered incorrectly #6320

23min opened this issue May 12, 2016 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority verified Verification succeeded
Milestone

Comments

@23min
Copy link

23min commented May 12, 2016

  • VSCode Version: Version 1.1.0 (1.1.0)
  • OS Version: Mac OS X Yosemite 10.10.5 (14F27)

Steps to Reproduce:

  1. Create a user snippet with a prefix "sup"
    (I created mine in ~/Library/Application Support/Code/User/snippets/elixir.json)
  2. In a file matching the language, type S or s, intellisense correctly suggests snippet "sup"
  3. When proceeding to type non-matching characters, e.g. erv intellisense still suggests snippet "sup"

screenshot 2016-05-12 13 26 23

Expected behavior:

When the typed characters no longer match the start of a snippet prefix, the snippet suggestion should not be shown.

@jrieken jrieken added bug Issue identified by VS Code Team member as probable bug editor labels May 12, 2016
@jrieken jrieken added this to the May 2016 milestone May 12, 2016
@jrieken
Copy link
Member

jrieken commented May 12, 2016

@23min Can you share your snippet with us? Trying this with the class snippet in JavaScript doesn't allow me to repo

may-12-2016 17-57-13

@jrieken jrieken added the info-needed Issue requires more information from poster label May 12, 2016
@23min
Copy link
Author

23min commented May 13, 2016

{

    // Place your snippets for Elixir here. Each snippet is defined under a snippet name and has a prefix, body and 
    // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
    // $1, $2 for tab stops, ${id} and ${id:label} and ${1:label} for variables. Variables with the same id are connected.
    // Example:
    "Print to console": {
        "prefix": "log",
        "body": [
            "console.log('$1');",
            "$2"
        ],
        "description": "Log output to console"
    },

        "Print to Somethjing": {
        "prefix": "Lassa",
        "body": [
            "console.log('$1');",
            "$2"
        ],
        "description": "Log output to console"
    },

    "Supervisor Template": {
        "prefix": "sup",
        "body": [
            "defmodule $1.Supervisor do",
                "\tuse Supervisor",
                "",
                "\tdef start_link do",
                    "\t\tSupervisor.start_link(__MODULE__, [])",
                "\tend",
                "",
                "\tdef init(_) do",
                    "\t\tchildren = [",
                        "\t\t\tworker($1.Server, [])",
                    "\t\t]",
                    "",
                    "\t\tsupervise(children, strategy: :one_for_one)",
                "\tend",
                "",
            "end",
            "$2"
        ],
        "description": "Creates a skeleton supervisor"
    },

    "GenServer Template": {
        "prefix": "gens",
        "body": [
            "defmodule $1 do",
                "\tuse GenServer",
                "", 
                "\tdef start_link do",
                    "\t\tGenServer.start_link(__MODULE__, :ok, [name: __MODULE__])",
                "\tend",
            "",  
            "end",
            "$2"
        ],
        "description": "Creates a minimal skeleton genserver"
    }   
}

@jrieken jrieken removed the info-needed Issue requires more information from poster label May 17, 2016
@jrieken
Copy link
Member

jrieken commented May 17, 2016

Understood. It is like this because we compare suggestions against their label, codeSnippet, and filterText. The first and last are clear to me but I don't remember why we filter against the codeSnippet...

@jrieken
Copy link
Member

jrieken commented May 23, 2016

Reopening and reverting this due to #6620

@jrieken jrieken reopened this May 23, 2016
@jrieken jrieken modified the milestones: June 2016, May 2016 May 23, 2016
@jrieken
Copy link
Member

jrieken commented May 23, 2016

Now depends on #6620

@jrieken jrieken reopened this May 26, 2016
@jrieken jrieken reopened this Jul 4, 2016
@jrieken jrieken modified the milestones: July 2016, June 2016 Jul 4, 2016
@jrieken
Copy link
Member

jrieken commented Jul 4, 2016

Sorry, need to revert again due to #8531. There is still something wrong with the json language which doesn't allow me to make this change

@jrieken jrieken closed this as completed in 0c5f6e8 Jul 4, 2016
@jrieken jrieken reopened this Jul 4, 2016
@jrieken jrieken added the important Issue identified as high-priority label Jul 4, 2016
@aeschli
Copy link
Contributor

aeschli commented Jul 4, 2016

Thanks @jrieken !

@egamma egamma mentioned this issue Jul 14, 2016
89 tasks
@fluffynuts
Copy link

This also affects "inbuilt" snippets: when working in Typescript, typing "c" shows the completion for the "class" snippet -- however, finishing out to "const" leaves the "class" snippet still selected, so an keypress to move to the next line for a bunch of consts gets me a class snippet.
So this isn't so much a case of "the wrong snippet selected" as "no snippet actually matches the word, but last last matching snippet is still selected".

I stumbled across this report from searching GitHub issues for vscode and snippets -- if this addition should be put somewhere else, please advise.

@chrmarti chrmarti added the verified Verification succeeded label Jul 28, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants