MCPcopy Index your code
hub / github.com/anomalyco/opencode / findVscodeRazorExtension

Function findVscodeRazorExtension

packages/opencode/src/lsp/server.ts:787–821  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

785}
786
787async function findVscodeRazorExtension() {
788 const roots = [
789 process.env.VSCODE_EXTENSIONS,
790 path.join(os.homedir(), ".vscode", "extensions"),
791 path.join(os.homedir(), ".vscode-insiders", "extensions"),
792 path.join(os.homedir(), ".vscode-server", "extensions"),
793 path.join(os.homedir(), ".vscode-server-insiders", "extensions"),
794 ].filter((item) => item !== undefined)
795
796 for (const root of [...new Set(roots)]) {
797 const entries = await fs.readdir(root, { withFileTypes: true }).catch(() => [])
798 const candidates = await Promise.all(
799 entries
800 .filter((entry) => entry.isDirectory() && entry.name.startsWith("ms-dotnettools.csharp-"))
801 .map(async (entry) => ({
802 path: path.join(root, entry.name, ".razorExtension"),
803 modified: (await fs.stat(path.join(root, entry.name)).catch(() => undefined))?.mtimeMs ?? 0,
804 })),
805 )
806 for (const entry of candidates.sort((a, b) => b.modified - a.modified).map((candidate) => candidate.path)) {
807 const result = {
808 compiler: path.join(entry, "Microsoft.CodeAnalysis.Razor.Compiler.dll"),
809 targets: path.join(entry, "Targets", "Microsoft.NET.Sdk.Razor.DesignTime.targets"),
810 extension: path.join(entry, "Microsoft.VisualStudioCode.RazorExtension.dll"),
811 }
812 if (
813 (await pathExists(result.compiler)) &&
814 (await pathExists(result.targets)) &&
815 (await pathExists(result.extension))
816 ) {
817 return result
818 }
819 }
820 }
821}
822
823export const FSharp: Info = {
824 id: "fsharp",

Callers 1

spawnFunction · 0.85

Calls 2

pathExistsFunction · 0.85
allMethod · 0.45

Tested by

no test coverage detected