@treedy/lsp-mcp 0.1.10 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -19958,6 +19958,33 @@ function getEnvString(name, defaultValue) {
19958
19958
  return process.env[name] ?? defaultValue;
19959
19959
  }
19960
19960
  function inferLanguageFromPath(filePath, config2) {
19961
+ if (fs.existsSync(filePath)) {
19962
+ try {
19963
+ const stat = fs.statSync(filePath);
19964
+ if (stat.isDirectory()) {
19965
+ if (config2.languages.typescript?.enabled && (fs.existsSync(path.join(filePath, "tsconfig.json")) || fs.existsSync(path.join(filePath, "package.json")))) {
19966
+ return "typescript";
19967
+ }
19968
+ if (config2.languages.python?.enabled && (fs.existsSync(path.join(filePath, "pyproject.toml")) || fs.existsSync(path.join(filePath, "requirements.txt")) || fs.existsSync(path.join(filePath, "setup.py")) || fs.existsSync(path.join(filePath, "venv")) || fs.existsSync(path.join(filePath, ".venv")))) {
19969
+ return "python";
19970
+ }
19971
+ if (config2.languages.vue?.enabled && (fs.existsSync(path.join(filePath, "vite.config.ts")) || fs.existsSync(path.join(filePath, "vue.config.js")))) {
19972
+ return "vue";
19973
+ }
19974
+ try {
19975
+ const entries = fs.readdirSync(filePath);
19976
+ for (const entry of entries) {
19977
+ if (entry.endsWith(".ts") && config2.languages.typescript?.enabled)
19978
+ return "typescript";
19979
+ if (entry.endsWith(".py") && config2.languages.python?.enabled)
19980
+ return "python";
19981
+ if (entry.endsWith(".vue") && config2.languages.vue?.enabled)
19982
+ return "vue";
19983
+ }
19984
+ } catch {}
19985
+ }
19986
+ } catch (e) {}
19987
+ }
19961
19988
  const ext = filePath.substring(filePath.lastIndexOf("."));
19962
19989
  for (const [lang, langConfig] of Object.entries(config2.languages)) {
19963
19990
  if (langConfig?.enabled && langConfig.extensions.includes(ext)) {
@@ -22067,7 +22094,15 @@ function preRegisterTools() {
22067
22094
  content: [{ type: "text", text: JSON.stringify({ error: "Missing 'file' or 'path' argument required for unified routing" }) }]
22068
22095
  };
22069
22096
  }
22070
- const language = inferLanguageFromPath(filePath, config2);
22097
+ let absPath = filePath;
22098
+ if (!path2.isAbsolute(filePath)) {
22099
+ if (activeWorkspacePath) {
22100
+ absPath = path2.join(activeWorkspacePath, filePath);
22101
+ } else {
22102
+ absPath = path2.resolve(filePath);
22103
+ }
22104
+ }
22105
+ const language = inferLanguageFromPath(absPath, config2);
22071
22106
  if (!language) {
22072
22107
  return {
22073
22108
  content: [
@@ -22157,14 +22192,14 @@ ${summary || "(No symbols found)"}`
22157
22192
  }
22158
22193
  if (tool.name === "read_file_with_hints") {
22159
22194
  try {
22160
- let absPath = filePath;
22195
+ let absPath2 = filePath;
22161
22196
  if (!path2.isAbsolute(filePath) && activeWorkspacePath) {
22162
- absPath = path2.join(activeWorkspacePath, filePath);
22197
+ absPath2 = path2.join(activeWorkspacePath, filePath);
22163
22198
  }
22164
- if (!fs2.existsSync(absPath)) {
22165
- return { content: [{ type: "text", text: JSON.stringify({ error: `File not found: ${absPath}` }) }] };
22199
+ if (!fs2.existsSync(absPath2)) {
22200
+ return { content: [{ type: "text", text: JSON.stringify({ error: `File not found: ${absPath2}` }) }] };
22166
22201
  }
22167
- const content = fs2.readFileSync(absPath, "utf-8");
22202
+ const content = fs2.readFileSync(absPath2, "utf-8");
22168
22203
  const result = await backendManager.callTool(language, "inlay_hints", args);
22169
22204
  const parsed = JSON.parse(result.content[0].text);
22170
22205
  if (parsed.error) {
@@ -22275,4 +22310,4 @@ main().catch((error2) => {
22275
22310
  process.exit(1);
22276
22311
  });
22277
22312
 
22278
- //# debugId=4446D59062B5AFD964756E2164756E21
22313
+ //# debugId=B5844EF744B1563264756E2164756E21