Skip to content

static keyword shown as invalid #65

Open

Description

@aaronmoodie

Code that I'm using (from Stimulus homepage)

// hello_controller.js
import { Controller } from "stimulus"

export default class extends Controller {
  static targets = [ "name", "output" ]

  greet() {
    this.outputTarget.textContent =
      `Hello, ${this.nameTarget.value}!`
  }
}

output
image

The same thing is happening with the private keyword.

Activity

  1. leenapps commented on Sep 6, 2021

    @leenapps

    I fixed this for me by going to the bundle editor
    Bundles>Javascript>Language Grammars>Javascript
    And add static to the matches next to 'keyword.control.js';

  2. ogallagher commented on Apr 2, 2022

    @ogallagher

    The pull req from savetheclocktower/overhaul appears to fix this as well.

    class internal static variable color

  3. 7ombie commented on Feb 6, 2023

    @7ombie

    The same thing is happening with the private keyword.

    There is no private keyword in JavaScript (it uses hashnames, like this.#attribute and #method(){}), so that is rendering correctly. The static keyword does need adding though (see @leenapps' answer).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions