Skip to content

Autocomplete for "console.log()" in JavaScript and TypeScript is wrong. #9072

Closed

Description

  • VSCode Version: 1.3.0 (1.3.0)
  • OS Version: OS X 10.11.5 (15F34)

Steps to Reproduce:

  1. type console.l
  2. Press tab to autocomplete
  3. the result is "console.console.log();"

It looks like not the method "log" is autocompleted but the entire class + function.

Activity

  1. added
    bug
    on Jul 11, 2016
  2. dbaeumer commented on Jul 12, 2016

    @dbaeumer
    Member

    Vladimir Amiorkov (@VladimirAmiorkov) do you have an extension installed that adds snippets. Looks like you selected a snippet. I can't reproduce this using 1.3.0

    cast

  3. dbaeumer commented on Jul 12, 2016

    @dbaeumer
    Member

    Please ping if you see this on a vanilla VSCode install. A test project showing the error would be helpful

  4. added
    info-needed
    on Jul 12, 2016
  5. VladimirAmiorkov commented on Jul 12, 2016

    @VladimirAmiorkov
    Author

    Hi Dirk Bäumer (@dbaeumer) ,

    I can confirm that without any extensions I can reproduce this issue in a TypeScript file (.ts) in JavaScript it seams to be ok after removing 3 extensions (TypeScript extension, Angular 2 and NativeScript). But the fact that it was ok for both TypeScript and JavaScript with those 3 extension before upgrading to the latest version is troubling.

    jul-12-2016 10-42-21

  6. removed
    info-needed
    on Jul 13, 2016
  7. dbaeumer commented on Jul 13, 2016

    @dbaeumer
    Member

    Johannes Rieken (@jrieken) assigning to you since this is not caused by TS/JS. Looks like that an extensions adds a snippet and the snippet now wins over the TS proposal.

  8. jrieken commented on Jul 13, 2016

    @jrieken
    Contributor

    I do not own snippets

  9. dbaeumer commented on Jul 13, 2016

    @dbaeumer
    Member

    As I understand the issue the user has an extension which snippets win over TS/JS proposal. Did something change in regards of sorting/priority. It seemed to work for 1.2.x

  10. jrieken commented on Jul 13, 2016

    @jrieken
    Contributor

    Dirk Bäumer (@dbaeumer) No - this is because TypeScript ships with a console.log snippet

  11. dbaeumer commented on Jul 13, 2016

    @dbaeumer
    Member

    Johannes Rieken (@jrieken) yes I know, but we always did. Vladimir Amiorkov (@VladimirAmiorkov) pointed out this happened after upgrading to 1.3.0 (see #9072 (comment))

    For JS his problem disappeared after uninstalling the extensions. Interestingly we don't ship with a log snippet for JS. This is why I ask you whether something has changed in the code to pick the first match.

    For TS this is a very strange behavior and I don't know whether its is you or João Moreno (@joaomoreno). See the screen cast. When you first type the 'l' the log method is selected when you go back the snippet is selected. This is with VSCode 1.2.1

    cast

    And this is with 1.3.x

    cast

  12. jrieken commented on Jul 13, 2016

    @jrieken
    Contributor

    Martin Aeschlimann (@aeschli) owns the SnippetRegistry which is responsible for inserting snippet completions

  13. aeschli commented on Jul 13, 2016

    @aeschli
    Contributor

    The problem is IMO not that the snippet proposal appears: Its name prefix-matches the current word, that's why it appears. The problem is that it get's ranked before any of the language proposals in particular the log proposal.
    Either we improve the sort order or we remove snippet proposals from the the code completion list and put them on a separate key.

  14. added
    *duplicate
    on Jul 14, 2016
  15. jrieken commented on Jul 14, 2016

    @jrieken
    Contributor

    closing as duplicate of #9286

  16. masaeedu commented on Jul 30, 2016

    @masaeedu

    Johannes Rieken (@jrieken) #9286 is a feature request, this is a bug. Is this bug fixed, or is there a workaround enabled by #9286?

  17. locked and limited conversation to collaborators on Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*duplicatebug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions