microsoft / microsoft/TypeScript

Extra entries for JavaScript auto complete(intellisense) make no sense

Aperta
#15,679 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Committed Domain: JavaScript Domain: LS: Completion Lists Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.4k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

TypeScript Version: 2.2.1 / nightly (2.2.0-dev.201xxxxx)

Code
The following code in javascript:

/**
* @param {MessageActivity} activity
* @param {IConversationContext} context
*/
export function Prompt_beforeResponse(activity, context)
{
  // MessageActivity is defined in typescript definition provided to the editor as having 4 properties (attachements, text, speak, type). 
 // Typing activity. will show those for properties but also: 
 //     activity  - why should activity be under itself?
 //     context - why should the second parameter be under activity?
 //     IConversationContext - why would a type, that is not a property in any object be under activity?
 //     MessageActivity - same question as above
 //     onRun - why should a global function be under activity
 //     Prompt_when - same as above
 //     Prompt_beforeResponse - same question as above and this is the function itself


//  Here is another example. obj. should display only a and b, but it also shows activity, context, MessageActivity, IConversationContext, etc.
   /**
    * @type {{a: number, b: string }}
   */
   var obj = {};
   obj.
}
// A *self-contained* demonstration of the problem follows...

Expected behavior:
When a javascript type is not "any", i.e. when it is definded in jsdoc or in the typescript definition helper (See https://github.com/Microsoft/TypeScript/wiki/JavaScript-Language-Service-in-Visual-Studio#unsupported-patterns) only those defined members should be part of intellisense.
Even if the type is any, throwing everything on intellisense like that defeats the purpose of finding out what reasonably could be under the object.

Actual behavior:
A bunch of extra entries show up in intellisnese that make no sense for either typed or untyped scenarios, but it is specially bad for typed scenarios where some thought was put in place in what should appear in intellisense. Adding all those entries makes the intellisense feature less useful.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con il JavaScript language service e gli esempi JSDoc-typed nell’issue, riproducendo i risultati del completamento per activity. e obj. Confronta i suggerimenti con i membri dichiarati e il comportamento previsto descritto nel report. Il lavoro è completato quando globals, parametri, tipi e funzioni non correlati non compaiono più come completamenti per i valori JavaScript tipizzati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, typescript
Ambito
developer-experience, tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.