microsoft / microsoft/TypeScript

JSDoc property name is not parsed as expected when non-alphanumeric characters are present and intellisense not showing properties

Offen
#36,047 3 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Needs Proposal Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

TS Template added by @mjbvz

TypeScript Version: 3.8.0-dev.20200104

Search terms:

  • jsdoc / jsdocs
  • completionInfo

  • VSCode Version: 1.41.1 (user setup)
  • OS Version: Windows_NT x64 10.0.17134

Origin of this discovery:
I was trying to document my types which translate to XML classes. The syntax for which includes the "@class" as a property name of my object. This is not possible given the current syntax parsing in VSCode.

Steps to Reproduce:

  1. Place this code in the editor with the language as Javascript
    Code:
/**
 * @typedef Foo
 * @property {string} bar Property shows in intellisense
 * @property {string} @baz Property should show in intellisense but does not
 * @property {string} test Property should show in intellisense but does not
 * @property {string} @class Property name "@class" should be a possible property name that
 * does not get interpreted as a JSDoc instruction.
 * @property {string} even#ThisShouldBeAValidName! But the name is not parsed as expeted
 */

/**
 * @type {Foo}
 */
const fooInstance = {
	
}
  1. Prompt the intellisense to show within the "fooInstance" object.
    1. Expected: The properties @ baz and @ class should be highlighted like normal property names
      1. Actual: The properties are shown as if they were JSDoc instructions
    2. Expected: The property "even#ThisShouldBeAValidName!" should be highlighted like a normal property name
      1. Actual: The property is highlighted as expected until the "#" symbol and then it seems to be treated like a comment
    3. Expected: Intellisense should show all the properties
      1. Actual: Only the first property "bar" is shown. An empty string "" is shown as if it were another property name.

Does this issue occur when all extensions are disabled?: Yes

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 damit, das JSDoc typedef- und completionInfo-Verhalten im JavaScript-Editor anhand des Codebeispiels in diesem Issue nachzustellen. Verfolge, wie @property-Namen geparst werden und wie Vervollständigungen erzeugt werden; abgeschlossen ist die Aufgabe, wenn Namen mit @, # und ! erhalten bleiben und alle aufgeführten Eigenschaften in IntelliSense erscheinen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, typescript
Bereich
compilers, devtools
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

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