microsoft / microsoft/TypeScript

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

Offen
#52,739 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Domain: LS: Completion Lists In Discussion Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.4k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der verknüpften aktuellen Implementierung in typescript/src/completions/objectLiteralCompletions.ts und vergleiche ihr Verhalten mit den angeforderten TypeScript-Vervollständigungen. Als erledigt gilt die Unterstützung der aufgeführten String-, Boolean-, Array-ähnlichen und Objekt-Snippet-Formen sowie die Klärung des vorgeschlagenen Präferenzverhaltens und die Validierung der daraus resultierenden Vervollständigungsvorschläge.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, typescript
Bereich
developer-experience, tooling
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.