npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

typescript-nornj-plugin

v0.3.0

Published

TypeScript language service plugin that adds IntelliSense for nornj tagged templates

Downloads

34

Readme

TypeScript NornJ Plugin

TypeScript server plugin that adds intellisense for NornJ template engine

This is a fork of typescript-lit-html-plugin.

Features

  • IntelliSense for html tags and attributes.
  • Quick info hovers on tags.
  • Formatting support.
  • Auto closing tags.
  • Folding html.
  • CSS completions in style blocks.
  • Works with literal html strings that contain placeholders.

Usage

This plugin requires TypeScript 2.4 or later. It can provide intellisense in both JavaScript and TypeScript files within any editor that uses TypeScript to power their language features. The simplest way to use this plugin is through the nornj-highlight extension. This extension automatically enables the plugin, and also adds syntax highlighting for nornj and synchronization of settings between VS Code and the plugin.

To use a specific version of this plugin with VS Code, first install the plugin and a copy of TypeScript in your workspace:

npm install --save-dev typescript-nornj-plugin typescript

Then add a plugins section to your tsconfig.json or jsconfig.json

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "typescript-nornj-plugin"
      }
    ]
  }
}

Finally, run the Select TypeScript version command in VS Code to switch to use the workspace version of TypeScript for VS Code's JavaScript and TypeScript language support. You can find more information about managing typescript versions in the VS Code documentation.

Configuration

You can configure the behavior of this plugin in plugins section of in your tsconfig or jsconfig.

If you are using nornj-highlight extension for VS Code, you can configure these settings in the editor settings instead of using a tsconfig or jsconfig.

Tags

This plugin adds html IntelliSense to any template literal tagged with nj:

import nj from 'nornj';

nj`
    <div></div>
`

You can enable IntelliSense for other tag names by configuring "tags":

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "typescript-nornj-plugin",
        "tags": [
          "html",
          "nj",
          "njs",
          "t"
        ]
      }
    ]
  }
}

Formatting

The plugin formats html code by default. You can disable this by setting "format.enabled": false

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "typescript-nornj-plugin",
        "format": { "enabled": false }
      }
    ]
  }
}

Testing

Run the test using the e2e script:

(cd e2e && npm install)
npm run e2e

The repo also includes a vscode launch.json that you can use to debug the tests and the server. The Mocha Tests launch configuration starts the unit tests. Once a test is running and the TypeScript server for it has been started, use the Attach To TS Server launch configuration to debug the plugin itself.