-
-
Notifications
You must be signed in to change notification settings - Fork 39
/
generate-config-schema.js
32 lines (26 loc) · 1.1 KB
/
generate-config-schema.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* eslint-disable @typescript-eslint/no-var-requires */
'use strict';
const fs = require('fs');
const { execSync } = require('child_process');
const packageJson = require('./package.json');
const coc_ra_config = require('./coc-rust-analyzer-configurations.json');
const not_supported = [
'rust-analyzer.hover.actions.debug.enable',
'rust-analyzer.hover.actions.enable',
'rust-analyzer.hover.actions.gotoTypeDef.enable',
'rust-analyzer.hover.actions.implementations.enable',
'rust-analyzer.hover.actions.references.enable',
'rust-analyzer.hover.actions.run.enable',
];
let schema = execSync('rust-analyzer --print-config-schema', { encoding: 'utf8' });
schema = JSON.parse(schema);
Object.keys(schema).forEach((k) => {
if (!not_supported.includes(k)) {
coc_ra_config[k] = schema[k];
}
});
packageJson.contributes.configuration.properties = coc_ra_config;
fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2) + '\n');
for (const x of Object.keys(coc_ra_config).sort()) {
console.log(`| \`${x}\` | ${coc_ra_config[x].markdownDescription} | \`${coc_ra_config[x].default || null}\` |`);
}