microsoft / microsoft/TypeScript

More object literal snippet completions for `string`, `Object`, `Array` and `boolean` properties

Aperta
#52,739 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

Descrizione

Suggestion

🔍 Search Terms

List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily and help provide feedback.

✅ Viability Checklist

My suggestion meets these guidelines:

  • [z] This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • [z] This wouldn't change the runtime behavior of existing JavaScript code
  • [z] This could be implemented without emitting different JS based on the types of the expressions
  • [z] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • [z] This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

I think many users find includeCompletionsWithObjectLiteralMethodSnippets super useful, I have an idea to do the same for other types.

📃 Motivating Example

declare const configureMe: (options: {
    name: string
    type: 'a' | 'b'
    enable: boolean
    otherOptions: Record<string, any>
    mixins: any[]
}) => void

configureMe({
    
})
Screenshot 2023-02-13 at 13 04 31

Snippet completions described by types:

string : "$1",$0
boolean : ${1|true,false|},$0
arrayLike : [$1],$0 or : [\n\t$1\n],$0
object (but not class or regexp) : {$1},$0 or : {\n\t$1\n},$0`

Also I think preference should be added to allow these object literal completions with snippet to be displayed above original suggestions (or even remove these original suggestion, if user really wants it) eg completionsWithObjectLiteralSnippetsNonSnippetPosition: /*default*/ 'before' | 'after' | 'remove'

Also in vscode plugin I found extremely useful triggering additional suggest widget after such snippet completion accept.

Can I try to implement this if its good?

Note: I use on a daily basis with my TS plugin: here is current implementation if someone is interested.

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 dall’implementazione corrente collegata in typescript/src/completions/objectLiteralCompletions.ts e confrontane il comportamento con i completamenti TypeScript richiesti. Il lavoro è completato quando sono supportate le forme di snippet string, boolean, simili ad array e oggetto elencate, viene risolto il comportamento di preferenza proposto e vengono validate le suggerimenti di completamento risultanti.

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

Valutazione

Stack tecnologico
javascript, typescript
Ambito
developer-experience, tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.