inlang
m-function-matcher

m-function-matcher

Plugin

This plugin enables Sherlock (VS Code extension) to recognize m.message() function calls used by Paraglide JS.

Sherlock inline preview

What it does

  • Inline previews: See translations directly in your code editor
  • Message extraction: Extract hardcoded strings into messages
  • Linting: Get warnings for missing or invalid message references

Supported file types

  • TypeScript (.ts, .tsx)
  • JavaScript (.js, .jsx)
  • Svelte (.svelte)
  • Vue (.vue)
  • Astro (.astro)

Installation

Add the plugin to your project.inlang/settings.json:

{
	"modules": [
		"https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@latest/dist/index.js"
	]
}

Then install Sherlock from the VS Code marketplace.

Matched patterns

The plugin recognizes these patterns:

PatternExample
Simple callm.welcome()
With variablesm.greeting({ name: "World" })
In JSX{m.button_label()}

Project checks

Find unused messages with the inlang CLI:

npx @inlang/cli check --project ./project.inlang --unused-messages

The plugin exposes analyzeUsage for the SDK's checkProject({ project, files }) API. ESM JavaScript/TypeScript and Svelte AST analysis recognizes static message reads, function references, named imports and namespace imports. Dynamic accesses, namespace escapes, parse failures and unsupported formats report incomplete analysis, which withholds unused-message findings and deletion fixes. Each issue names the file and, where possible, the location (start/end) of the construct, e.g. m[`${fieldName}_label`].

See the SDK checks and fixes documentation for source snapshot requirements, supported syntax, limits and programmatic usage. This capability is separate from the existing IDE reference matchers.

Bundle size: the analysis bundles Babel's parser and Svelte's compiler, so dist/index.js is about 830 KB minified (28 KB before). It is not lazy-loaded: the SDK imports a plugin module as a single data: URL, where a separately loaded chunk can't be resolved.

Svelte analysis covers instance/module scripts (JavaScript or TypeScript) and template expressions, blocks, snippets, components and directives. Include .svelte files in the full source snapshot; no extra configuration is required. External scripts and unsupported script languages report incomplete analysis.