Home / Function/ getConfiguredServerPath() — astro Function Reference

getConfiguredServerPath() — astro Function Reference

Architecture documentation for the getConfiguredServerPath() function in client.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  a6057a9c_8fad_2f1d_4d76_97b7dba7b010["getConfiguredServerPath()"]
  399ea951_6c03_e083_9630_2d53da33e239["client.ts"]
  a6057a9c_8fad_2f1d_4d76_97b7dba7b010 -->|defined in| 399ea951_6c03_e083_9630_2d53da33e239
  2f150eb1_412e_c234_e921_947657ea09da["activate()"]
  2f150eb1_412e_c234_e921_947657ea09da -->|calls| a6057a9c_8fad_2f1d_4d76_97b7dba7b010
  style a6057a9c_8fad_2f1d_4d76_97b7dba7b010 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/language-tools/vscode/src/client.ts lines 110–156

async function getConfiguredServerPath(workspaceState: vscode.Memento) {
	const scope = 'astro.language-server';
	const detailedLSPath = vscode.workspace.getConfiguration(scope).inspect<string>('ls-path');

	const lsPath =
		detailedLSPath?.globalLanguageValue ||
		detailedLSPath?.defaultLanguageValue ||
		detailedLSPath?.globalValue ||
		detailedLSPath?.defaultValue;

	const workspaceLSPath =
		detailedLSPath?.workspaceFolderLanguageValue ||
		detailedLSPath?.workspaceLanguageValue ||
		detailedLSPath?.workspaceFolderValue ||
		detailedLSPath?.workspaceValue;

	const useLocalLanguageServerKey = `${scope}.useLocalLS`;
	let useWorkspaceServer = workspaceState.get<boolean>(useLocalLanguageServerKey);

	if (useWorkspaceServer === undefined && workspaceLSPath !== undefined) {
		const msg =
			'This workspace contains an Astro Language Server version. Would you like to use the workplace version?';
		const allowPrompt = 'Allow';
		const dismissPrompt = 'Dismiss';
		const neverPrompt = 'Never in This Workspace';

		const result = await vscode.window.showInformationMessage(
			msg,
			allowPrompt,
			dismissPrompt,
			neverPrompt,
		);

		if (result === allowPrompt) {
			await workspaceState.update(useLocalLanguageServerKey, true);
			useWorkspaceServer = true;
		} else if (result === neverPrompt) {
			await workspaceState.update(useLocalLanguageServerKey, false);
		}
	}

	if (useWorkspaceServer === true) {
		return workspaceLSPath || lsPath;
	} else {
		return lsPath;
	}
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does getConfiguredServerPath() do?
getConfiguredServerPath() is a function in the astro codebase, defined in packages/language-tools/vscode/src/client.ts.
Where is getConfiguredServerPath() defined?
getConfiguredServerPath() is defined in packages/language-tools/vscode/src/client.ts at line 110.
What calls getConfiguredServerPath()?
getConfiguredServerPath() is called by 1 function(s): activate.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free