Skip to content

roblox-ts/roblox-ts-extensions

Repository files navigation

roblox-ts Extensions

This is a Language Service plugin that improves the editing experience while using roblox-ts.

Features

  • Remove or prefix cross-boundary imports in intellisense.
  • Warn about non-type only cross-boundary imports.
  • Remove internal fields from roblox-ts types.
  • Remove deprecated entries from intellisense.
  • Remove @hidden entries from intellisense.

Visual Studio Code

If you use Visual Studio Code, it's recommended that you install this using our extension.

Installation

You install this like you would any npm package.

npm install --save-dev roblox-ts-extensions

To enable the plugin and configure it, please look to the sections below.

Configuration

interface PluginConfig {
	// The directories to be determined client-sided. Rojo is preferred, however these can override Rojo if necessary.
	// Default: []
	client: string | string[];

	// The directories to be determined server-sided. Rojo is preferred, however these can override Rojo if necessary.
	// Default: []
	server: string | string[];

	// The autocomplete mode to use.
	// Prefix: Prefixes completes with their network boundary, and makes cross-boundary (client<->server, shared->client/server) imports type only.
	// Remove: Removes any cross-boundary imports entirely. Does not affect manual imports or existing imports.
	// Default: prefix
	mode: "prefix" | "remove";

	// Whether to use Rojo to calculate server/client boundaries. The client and server properties can override certain directories if necessary.
	// Default: true
	useRojo: boolean;

	// What should non-type only cross-boundary imports be flagged as.
	// Set to off to disable diagnostics.
	// Default: warning
	diagnosticsMode: "off" | "warning" | "error" | "message";
}

Enabling

To enable the plugin, add the following "plugins" field to your tsconfig's compilerOptions. You can configure the plugin however you'd like, as shown above.

{
	"compilerOptions": {
		// ...
		"plugins": [
			{
				"name": "roblox-ts-extensions",

				// All the following fields are optional and will use their defaults if omitted.

				"client": [],
				"server": [],
				"mode": "prefix",
				"useRojo": true
			}
		]
	}
}

About

A language service plugin for roblox-ts

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •