API Strings
Here is a config to open the python file based on an api route in frappe:
import { type Config } from "vscl"
export default {
links: [
{
include: "*",
pattern: /"(?<link>frappe(\.[^"'`]+)+)"/g, // Clickable: "frappe.core.doctype.user.user.get_timezones"
handle: ({ linkText, workspace }) => {
const parts = linkText.split(".")
const apiName = parts.pop()
return {
target: workspace`${parts.join("/")}.py`,
tooltip: `Open python file for the "${apiName}" API.`,
jumpPattern: `def ${apiName}(`, // Jump to the function definition in user.py
}
},
},
],
} satisfies Config
Latest Changes
Breaking: The workspace and file helpers from vscode-links-cli will no longer work. Instead they are now arguments to the handle function (see examples).
Added different formats for the "Create Config" command (.ts, .js. .cjs, .mjs)
Moved the config loading from vscode-links-cli to the extension. The package is now deprecated. In replacement you can optionally install the vscl package to get typings and intellisense in your config.