coc-vscode-loader 1.2.8 → 1.3.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.
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "converter",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "converter",
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.3.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"commander": "^15.0.0",
|
|
12
12
|
"ts-morph": "^28.0.0",
|
package/converter/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "converter",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"private": true,
|
|
5
|
-
"description": "vscode
|
|
5
|
+
"description": "vscode \u2192 coc.nvim converter prototype",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"convert": "tsx src/cli.ts"
|
|
@@ -93,7 +93,7 @@ import * as path from 'path'
|
|
|
93
93
|
export async function activate(context: ExtensionContext): Promise<void> {
|
|
94
94
|
try {
|
|
95
95
|
${ls.verbose ? ` console.log('[${escapeStr(id)}] activate() called')\n` : ''}${serverPathCode}
|
|
96
|
-
if (!serverPath) {
|
|
96
|
+
if (!serverPath && !_mainEntry) {
|
|
97
97
|
${ls.verbose ? ` console.log('[${escapeStr(id)}] serverPath undefined')\n` : ''}\
|
|
98
98
|
window.showErrorMessage('Cannot find language server.')
|
|
99
99
|
return
|
|
@@ -47,19 +47,7 @@ export const snippetsGenerator: StepGenerator = {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
if (fileToLanguages.size === 0) {
|
|
50
|
-
|
|
51
|
-
// No paths resolved. Generate default paths from languages list so empty file
|
|
52
|
-
// fallback can create them later.
|
|
53
|
-
if (verbose) console.warn(' snippets: no paths resolved from contributedSnippets, using defaults')
|
|
54
|
-
for (const lang of ss.languages) {
|
|
55
|
-
const defaultPath = `./snippets/${lang}.json`
|
|
56
|
-
const langs = fileToLanguages.get(defaultPath) || []
|
|
57
|
-
langs.push(lang)
|
|
58
|
-
fileToLanguages.set(defaultPath, langs)
|
|
59
|
-
}
|
|
60
|
-
} else {
|
|
61
|
-
throw new Error('snippets step: no snippet files found to copy')
|
|
62
|
-
}
|
|
50
|
+
throw new Error('snippets step: no snippet files found to copy')
|
|
63
51
|
}
|
|
64
52
|
|
|
65
53
|
// Create output directories and copy files to original relative paths
|
|
@@ -73,7 +61,7 @@ export const snippetsGenerator: StepGenerator = {
|
|
|
73
61
|
for (const [sourceRelPath, languages] of fileToLanguages) {
|
|
74
62
|
const sourceFile = path.join(input, sourceRelPath)
|
|
75
63
|
if (!fs.existsSync(sourceFile)) {
|
|
76
|
-
|
|
64
|
+
console.warn(` snippets: source file not found: ${sourceFile}, skipping`)
|
|
77
65
|
continue
|
|
78
66
|
}
|
|
79
67
|
const dest = path.join(output, sourceRelPath)
|
|
@@ -87,9 +75,18 @@ export const snippetsGenerator: StepGenerator = {
|
|
|
87
75
|
if (copiedCount === 0 && ss.build) {
|
|
88
76
|
// Run build script to generate snippet files (e.g. node merge.js)
|
|
89
77
|
if (verbose) console.log(` snippets: running build: ${ss.build}`)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
78
|
+
try {
|
|
79
|
+
execFileSync('npm', ['install', '--legacy-peer-deps'], { cwd: input, stdio: verbose ? 'inherit' : 'pipe' })
|
|
80
|
+
const [cmd, ...args] = ss.build.split(' ')
|
|
81
|
+
execFileSync(cmd, args, { cwd: input, stdio: verbose ? 'inherit' : 'pipe' })
|
|
82
|
+
} catch (e: any) {
|
|
83
|
+
if (e.code === 'ENOENT') {
|
|
84
|
+
const cmd = ss.build.split(' ')[0]
|
|
85
|
+
console.warn(` snippets: build tool "${cmd}" not found. Install it and try again, or remove the "build" field from the registry entry.`)
|
|
86
|
+
} else {
|
|
87
|
+
console.warn(` snippets: build failed (${e.message}), skipping`)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
93
90
|
// Retry copying
|
|
94
91
|
for (const [sourceRelPath, languages] of fileToLanguages) {
|
|
95
92
|
const sourceFile = path.join(input, sourceRelPath)
|
|
@@ -105,21 +102,7 @@ export const snippetsGenerator: StepGenerator = {
|
|
|
105
102
|
}
|
|
106
103
|
|
|
107
104
|
if (copiedCount === 0) {
|
|
108
|
-
|
|
109
|
-
// so contributes.snippets references resolve correctly in the output package.json.
|
|
110
|
-
if (verbose) console.warn(' snippets: no snippet files found, generating empty files')
|
|
111
|
-
for (const [sourceRelPath, languages] of fileToLanguages) {
|
|
112
|
-
const dest = path.join(output, sourceRelPath)
|
|
113
|
-
if (fs.existsSync(dest)) continue
|
|
114
|
-
fs.mkdirSync(path.dirname(dest), { recursive: true })
|
|
115
|
-
fs.writeFileSync(dest, '{}')
|
|
116
|
-
copiedCount++
|
|
117
|
-
allLanguages.push(...languages)
|
|
118
|
-
if (verbose) console.log(` snippets: generated empty ${sourceRelPath}`)
|
|
119
|
-
}
|
|
120
|
-
if (copiedCount === 0) {
|
|
121
|
-
throw new Error('snippets step: no snippet files were copied and no languages configured')
|
|
122
|
-
}
|
|
105
|
+
throw new Error('snippets step: no snippet files were copied')
|
|
123
106
|
}
|
|
124
107
|
|
|
125
108
|
// Generate empty src/index.ts
|
package/lib/index.js
CHANGED
|
@@ -39,7 +39,7 @@ var require_package = __commonJS({
|
|
|
39
39
|
"package.json"(exports2, module2) {
|
|
40
40
|
module2.exports = {
|
|
41
41
|
name: "coc-vscode-loader",
|
|
42
|
-
version: "1.
|
|
42
|
+
version: "1.3.0",
|
|
43
43
|
description: "Run VS Code extensions seamlessly in coc.nvim",
|
|
44
44
|
main: "lib/index.js",
|
|
45
45
|
keywords: [
|