diff --git a/.scripts/samples.js b/.scripts/samples.js index 9ee0533f..5ec8ac66 100644 --- a/.scripts/samples.js +++ b/.scripts/samples.js @@ -53,14 +53,14 @@ const samples = [ { description: 'LSP Multi Root Server Sample', path: 'lsp-multi-server-sample', - guide: null, + guide: 'https://github.com/Microsoft/vscode/wiki/Extension-Authoring:-Adopting-Multi-Root-Workspace-APIs#language-client--language-server', apis: [], contributions: [] }, { description: 'LSP Sample', path: 'lsp-sample', - guide: null, + guide: '/api/language-extensions/smart-editing-lsp-guide', apis: [], contributions: [] }, diff --git a/.scripts/update-readme.js b/.scripts/update-readme.js index 62e3a7d6..fb5e5545 100644 --- a/.scripts/update-readme.js +++ b/.scripts/update-readme.js @@ -12,35 +12,39 @@ const TABLE_END = ` ` -const getTableRow = (sample) => { - const descriptionCell = `[${sample.description}](${sample.path})` - const guideCell = sample.guide ? `[${sample.guide}](https://vscode-ext-docs.azurewebsites.net${sample.guide})` : 'N/A' +const getTableRow = sample => { + const descriptionCell = `[${sample.description}](${sample.path})` + let guideCell + if (!sample.guide) { + guideCell = 'N/A' + } else if (sample.guide && sample.guide.startsWith('http')) { + guideCell = sample.guide + } else { + guideCell = `[${sample.guide}](https://vscode-ext-docs.azurewebsites.net${sample.guide})` + } - const apis = sample.apis.map(api => { - return `[${api}](https://vscode-ext-docs.azurewebsites.net/api/references/vscode-api#${api})` - }) - const contributions = sample.contributions.map(c => { - return `[${c}](https://vscode-ext-docs.azurewebsites.net/api/references/contribution-points#${c})` - }) - const apiAndContributionCell = apis.concat(contributions).join('
') + const apis = sample.apis.map(api => { + return `[${api}](https://vscode-ext-docs.azurewebsites.net/api/references/vscode-api#${api})` + }) + const contributions = sample.contributions.map(c => { + return `[${c}](https://vscode-ext-docs.azurewebsites.net/api/references/contribution-points#${c})` + }) + const apiAndContributionCell = apis.concat(contributions).join('
') - return `| ${descriptionCell} | ${guideCell} | ${apiAndContributionCell} |` + return `| ${descriptionCell} | ${guideCell} | ${apiAndContributionCell} |` } -const getSamplesTable = (samples) => { - const samplesMd = samples - .map(s => getTableRow(s)) - .join('\n') +const getSamplesTable = samples => { + const samplesMd = samples.map(s => getTableRow(s)).join('\n') - return ` + return ` ${TABLE_HEAD.trim()} ${samplesMd} ${TABLE_END.trim()} ` - } const readme = fs.readFileSync('README.md', 'utf-8') const newReadme = readme.replace(/(.|\n)*/gm, getSamplesTable(SAMPLES)) -fs.writeFileSync('README.md', newReadme) \ No newline at end of file +fs.writeFileSync('README.md', newReadme) diff --git a/README.md b/README.md index ae70c243..decefcfe 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ You can expect from each sample: ## Samples + | Sample | Guide on VS Code Website | API & Contribution | | ------ | ----- | --- | @@ -31,8 +32,8 @@ You can expect from each sample: | [i18n-sample](i18n-sample) | N/A | | | [legacy-samples](legacy-samples) | N/A | | | [LSP Log Streaming Sample](lsp-log-streaming-sample) | N/A | | -| [LSP Multi Root Server Sample](lsp-multi-server-sample) | N/A | | -| [LSP Sample](lsp-sample) | N/A | | +| [LSP Multi Root Server Sample](lsp-multi-server-sample) | https://github.com/Microsoft/vscode/wiki/Extension-Authoring:-Adopting-Multi-Root-Workspace-APIs#language-client--language-server | | +| [LSP Sample](lsp-sample) | [/api/language-extensions/smart-editing-lsp-guide](https://vscode-ext-docs.azurewebsites.net/api/language-extensions/smart-editing-lsp-guide) | | | [multi-diagnostics-sample](multi-diagnostics-sample) | N/A | | | [nodefs-provider-sample](nodefs-provider-sample) | N/A | | | [progress-sample](progress-sample) | N/A | | @@ -47,6 +48,7 @@ You can expect from each sample: + ## :warning: Legacy Samples :warning: Legacy samples are at [`/legacy-samples`](/legacy-samples). They are unlikely to receive any updates and might not work with the latest version of VS Code.