Skip to content

Class name autocomplete does not suggest local aliases #440

Open
@weirdan

Description

@weirdan
  1. Created new file in an exiting composer project
  2. There's a Zend\Diactoros\ServerRequest class available somewhere in vendor folder
  3. Typed:
    <?php
    namespace zzz;
    use Zend\Diactoros\ServerRequest as SomeRequest;
    
    $q = new SomeReq
  4. Pressed Ctrl+Space
  5. Observed:
    1. 'No suggestions'
    2. In developer console there is suggestion returned, but language server suggests original short class name (ServerRequest in this case):
      [Extension Host] Content-Type: application/vscode-jsonrpc; charset=utf8
      Content-Length: 878
      
      {"result":{"isIncomplete":true,"items":[{"label":"ServerRequest","kind":7,"detail":"Zend\\Diactoros","documentation":"Server-side HTTP request\n\nExtends the Request definition to add methods for accessing incoming data,\nspecifically server parameters, cookies, matched path parameters, query\nstring arguments, body parameters, and upload file information.\n\n\"Attributes\" are discovered via decomposing the request (and usually\nspecifically the URI path), and typically will be injected by the application.\n\nRequests are considered immutable; all methods that might change state are\nimplemented such that they retain the internal state of the current\nmessage and return a new instance that contains the changed state.","sortText":null,"filterText":null,"insertText":null,"textEdit":null,"additionalTextEdits":null,"command":null,"data":null}]},"id":94,"jsonrpc":"2.0"}
      

I suspect either vscode-side extension or vscode itself filters this suggestion out because it doesn't match what has been typed.
Couldn't be local alias returned instead?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions