@vue/typescript-plugin
Advanced tools
Comparing version 2.0.11 to 2.0.12
@@ -33,3 +33,3 @@ "use strict"; | ||
} | ||
: undefined)); | ||
: null)); | ||
} | ||
@@ -36,0 +36,0 @@ else if (project) { |
@@ -36,2 +36,3 @@ "use strict"; | ||
const client = net.connect(path); | ||
client.setTimeout(1000); | ||
client.on('connect', () => { | ||
@@ -43,2 +44,5 @@ resolve(client); | ||
}); | ||
client.on('timeout', () => { | ||
return resolve(undefined); | ||
}); | ||
}); | ||
@@ -54,3 +58,3 @@ } | ||
.sort((a, b) => b.currentDirectory.length - a.currentDirectory.length); | ||
for (const server of configuredServers) { | ||
for (const server of configuredServers.sort((a, b) => sortTSConfigs(fileName, a.currentDirectory, b.currentDirectory))) { | ||
const client = await connect(server.path); | ||
@@ -80,5 +84,22 @@ if (client) { | ||
exports.searchNamedPipeServerForFile = searchNamedPipeServerForFile; | ||
function sortTSConfigs(file, a, b) { | ||
const inA = isFileInDir(file, path.dirname(a)); | ||
const inB = isFileInDir(file, path.dirname(b)); | ||
if (inA !== inB) { | ||
const aWeight = inA ? 1 : 0; | ||
const bWeight = inB ? 1 : 0; | ||
return bWeight - aWeight; | ||
} | ||
const aLength = a.split('/').length; | ||
const bLength = b.split('/').length; | ||
return bLength - aLength; | ||
} | ||
function isFileInDir(fileName, dir) { | ||
const relative = path.relative(dir, fileName); | ||
return !!relative && !relative.startsWith('..') && !path.isAbsolute(relative); | ||
} | ||
function sendRequestWorker(request, client) { | ||
return new Promise(resolve => { | ||
let dataChunks = []; | ||
client.setTimeout(5000); | ||
client.on('data', chunk => { | ||
@@ -106,2 +127,10 @@ dataChunks.push(chunk); | ||
}); | ||
client.on('error', err => { | ||
console.error('[Vue Named Pipe Client] Error:', err.message); | ||
resolve(undefined); | ||
}); | ||
client.on('timeout', () => { | ||
console.error('[Vue Named Pipe Client] Timeout'); | ||
resolve(undefined); | ||
}); | ||
client.write(JSON.stringify(request)); | ||
@@ -108,0 +137,0 @@ }); |
{ | ||
"name": "@vue/typescript-plugin", | ||
"version": "2.0.11", | ||
"version": "2.0.12", | ||
"license": "MIT", | ||
@@ -15,4 +15,4 @@ "files": [ | ||
"dependencies": { | ||
"@volar/typescript": "~2.2.0-alpha.6", | ||
"@vue/language-core": "2.0.11", | ||
"@volar/typescript": "2.2.0-alpha.7", | ||
"@vue/language-core": "2.0.12", | ||
"@vue/shared": "^3.4.0" | ||
@@ -23,3 +23,3 @@ }, | ||
}, | ||
"gitHead": "c89f25ffc32c760130adeeac796b9a5d20585bf7" | ||
"gitHead": "c1c4e1a2a6c32da59351641bd41bf7f5db0cac69" | ||
} |
49612
1061
+ Added@volar/language-core@2.2.0-alpha.7(transitive)
+ Added@volar/source-map@2.2.0-alpha.7(transitive)
+ Added@volar/typescript@2.2.0-alpha.7(transitive)
+ Added@vue/language-core@2.0.12(transitive)
- Removed@volar/language-core@2.2.5(transitive)
- Removed@volar/source-map@2.2.5(transitive)
- Removed@volar/typescript@2.2.5(transitive)
- Removed@vue/language-core@2.0.11(transitive)
Updated@vue/language-core@2.0.12