microsoft / microsoft/TypeScript

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

Open
#36,047 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Proposal Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the JSDoc typedef and completionInfo behavior in the JavaScript editor using the code sample in this issue. Trace how @property names are parsed and how completions are produced; done means names containing @, #, and ! are preserved and all listed properties appear in IntelliSense.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
compilers, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.