cadl/.vscode/launch.json

170 строки
5.1 KiB
JSON
Исходник Постоянная ссылка Обычный вид История

2021-08-25 22:47:06 +03:00
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
2021-08-25 22:47:06 +03:00
"request": "attach",
"name": "Attach to Default Port",
"port": 9229,
"smartStep": true,
"sourceMaps": true,
"skipFiles": ["<node_internals>/**/*.js"],
"outFiles": [
"${workspaceFolder}/packages/*/dist/**/*.js",
"${workspaceFolder}/packages/*/dist-dev/**/*.js"
],
"presentation": {
"order": 999
}
},
{
"type": "node",
"request": "launch",
"name": "Debug Current Test File",
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"program": "${workspaceRoot}/packages/compiler/node_modules/vitest/vitest.mjs",
"args": ["run", "${relativeFile}"],
"smartStep": true
},
2021-08-25 22:47:06 +03:00
{
"name": "Attach to Language Server",
"type": "node",
2021-08-25 22:47:06 +03:00
"request": "attach",
"port": 4242,
"restart": {
"delay": 100,
"maxAttempts": 10
},
"continueOnAttach": true,
"smartStep": true,
"sourceMaps": true,
"skipFiles": ["<node_internals>/**/*.js"],
"outFiles": [
"${workspaceFolder}/packages/*/dist/**/*.js",
"${workspaceFolder}/packages/*/dist-dev/**/*.js"
],
"timeout": 60000,
"presentation": {
"order": 999
}
},
{
"type": "node",
2021-08-25 22:47:06 +03:00
"request": "launch",
"name": "Compile Scratch",
"program": "${workspaceFolder}/packages/compiler/entrypoints/cli.js",
2022-06-08 02:06:06 +03:00
"args": [
"compile",
"../samples/scratch",
"--output-dir=temp/scratch-output",
2023-02-16 01:37:39 +03:00
"--emit=@typespec/openapi3"
2022-06-08 02:06:06 +03:00
],
2021-08-25 22:47:06 +03:00
"smartStep": true,
"sourceMaps": true,
"skipFiles": ["<node_internals>/**/*.js"],
"outFiles": [
"${workspaceFolder}/packages/*/dist/**/*.js",
"${workspaceFolder}/packages/*/dist-dev/**/*.js"
],
"cwd": "${workspaceFolder}/packages/compiler",
2021-08-25 22:47:06 +03:00
"presentation": {
"order": 2
}
},
{
"type": "node",
2021-08-25 22:47:06 +03:00
"request": "launch",
"name": "Compile Scratch (nostdlib)",
"program": "${workspaceFolder}/packages/compiler/entrypoints/cli.js",
"args": ["compile", "../samples/scratch", "--output-dir=temp/scratch-output", "--nostdlib"],
2021-08-25 22:47:06 +03:00
"smartStep": true,
"sourceMaps": true,
"skipFiles": ["<node_internals>/**/*.js"],
"outFiles": [
"${workspaceFolder}/packages/*/dist/**/*.js",
"${workspaceFolder}/packages/*/dist-dev/**/*.js"
],
"cwd": "${workspaceFolder}/packages/compiler",
2021-08-25 22:47:06 +03:00
"presentation": {
"order": 2
}
},
{
"name": "Regenerate .tmlanguage",
"type": "node",
2023-02-16 01:37:39 +03:00
"program": "${workspaceFolder}/packages/typespec-vscode/scripts/generate-tmlanguage.js",
2021-08-25 22:47:06 +03:00
"request": "launch",
2023-02-16 01:37:39 +03:00
"cwd": "${workspaceFolder}/packages/typespec-vscode",
2021-08-25 22:47:06 +03:00
"presentation": {
"order": 999
}
},
{
"name": "VS Code Extension (Client)",
"type": "extensionHost",
"request": "launch",
2023-02-16 01:37:39 +03:00
"args": ["--extensionDevelopmentPath=${workspaceFolder}/packages/typespec-vscode"],
"outFiles": ["${workspaceFolder}/packages/typespec-vscode/dist/**/*.cjs"],
2021-08-25 22:47:06 +03:00
"env": {
Make syntax tree typing deeply readonly and reuse them in language server (#868) ## Summary * Make syntax trees deeply `readonly` in their TS typing. * Remove mutation of symbol tables contained in syntax trees in checker. * Reuse syntax trees for unchanged files in language server. * Reuse entire program when no files have changed in language server. * Fix other miscellaneous perf issues found while profiling the impact of this change: * Avoid repeat loading of config file * Avoid repeat creation of schema validators * Avoid unnecessary parse in findDocumentHighlight. * Add environment variables to log language server call timing and/or save .cpuprofile files to help with future perf work in this area. ## Performance I'm seeing approximately 2X less time spent in language server for typing the same sequence into petstore.cadl and navigating around with goto-definition, document-highlight. ## Details * We used to inject symbols into symbol tables hanging off syntax trees to implement using statements including the implicit `using Cadl` and member references. To avoid this, we now do a copy-on-write to the symbol tables. This adds an extra map lookup for each call to resolveIdentifierInTable, where we first look for a copy of the table and then do the actual lookup. No noticeable slowdown was observed in profiling based on this. It does double the time in resolveIdentifierInTable as 1 lookup becomes two, but this does not make a significant difference overall and I think it's a worthwhile trade to get the reuse. * `createProgram` gains a new `oldProgram` argument from which we will reuse syntax trees if the host gave us identical `SourceFile` instances. We will also reuse the entire oldProgram and skip checking if we find that the compiler options and source file set are unchanged. Language server keeps track of last compilation for a given entry point to provide oldProgram. Over time, it's possible that we can reuse more of oldProgram in more cases. * `CompilerHost` gains a new optional `parseCache` that allows sharing syntax trees between programs even if oldProgram is not supplied or the oldProgram didn't have a particular source file. This is particularly useful for language server features that do not need an entire program but just the syntax tree of the current document. The language server also uses this. * ParseOptions (currently include comments or not) can now be specified on `CompilerOptions`. Language server uses this to always include comments so that features that need comments can share trees with features that don't.
2022-08-24 17:36:05 +03:00
// Log elapsed time for each call to server.
2023-02-16 01:37:39 +03:00
//"TYPESPEC_SERVER_LOG_TIMING": "true",
Make syntax tree typing deeply readonly and reuse them in language server (#868) ## Summary * Make syntax trees deeply `readonly` in their TS typing. * Remove mutation of symbol tables contained in syntax trees in checker. * Reuse syntax trees for unchanged files in language server. * Reuse entire program when no files have changed in language server. * Fix other miscellaneous perf issues found while profiling the impact of this change: * Avoid repeat loading of config file * Avoid repeat creation of schema validators * Avoid unnecessary parse in findDocumentHighlight. * Add environment variables to log language server call timing and/or save .cpuprofile files to help with future perf work in this area. ## Performance I'm seeing approximately 2X less time spent in language server for typing the same sequence into petstore.cadl and navigating around with goto-definition, document-highlight. ## Details * We used to inject symbols into symbol tables hanging off syntax trees to implement using statements including the implicit `using Cadl` and member references. To avoid this, we now do a copy-on-write to the symbol tables. This adds an extra map lookup for each call to resolveIdentifierInTable, where we first look for a copy of the table and then do the actual lookup. No noticeable slowdown was observed in profiling based on this. It does double the time in resolveIdentifierInTable as 1 lookup becomes two, but this does not make a significant difference overall and I think it's a worthwhile trade to get the reuse. * `createProgram` gains a new `oldProgram` argument from which we will reuse syntax trees if the host gave us identical `SourceFile` instances. We will also reuse the entire oldProgram and skip checking if we find that the compiler options and source file set are unchanged. Language server keeps track of last compilation for a given entry point to provide oldProgram. Over time, it's possible that we can reuse more of oldProgram in more cases. * `CompilerHost` gains a new optional `parseCache` that allows sharing syntax trees between programs even if oldProgram is not supplied or the oldProgram didn't have a particular source file. This is particularly useful for language server features that do not need an entire program but just the syntax tree of the current document. The language server also uses this. * ParseOptions (currently include comments or not) can now be specified on `CompilerOptions`. Language server uses this to always include comments so that features that need comments can share trees with features that don't.
2022-08-24 17:36:05 +03:00
// Save .cpuprofile for last run of each server function here
// NOTE: This will add a lot of lag so don't trust logged timing if also enabled above.
2023-02-16 01:37:39 +03:00
//"TYPESPEC_SERVER_PROFILE_DIR": "${workspaceRoot}/temp",
Make syntax tree typing deeply readonly and reuse them in language server (#868) ## Summary * Make syntax trees deeply `readonly` in their TS typing. * Remove mutation of symbol tables contained in syntax trees in checker. * Reuse syntax trees for unchanged files in language server. * Reuse entire program when no files have changed in language server. * Fix other miscellaneous perf issues found while profiling the impact of this change: * Avoid repeat loading of config file * Avoid repeat creation of schema validators * Avoid unnecessary parse in findDocumentHighlight. * Add environment variables to log language server call timing and/or save .cpuprofile files to help with future perf work in this area. ## Performance I'm seeing approximately 2X less time spent in language server for typing the same sequence into petstore.cadl and navigating around with goto-definition, document-highlight. ## Details * We used to inject symbols into symbol tables hanging off syntax trees to implement using statements including the implicit `using Cadl` and member references. To avoid this, we now do a copy-on-write to the symbol tables. This adds an extra map lookup for each call to resolveIdentifierInTable, where we first look for a copy of the table and then do the actual lookup. No noticeable slowdown was observed in profiling based on this. It does double the time in resolveIdentifierInTable as 1 lookup becomes two, but this does not make a significant difference overall and I think it's a worthwhile trade to get the reuse. * `createProgram` gains a new `oldProgram` argument from which we will reuse syntax trees if the host gave us identical `SourceFile` instances. We will also reuse the entire oldProgram and skip checking if we find that the compiler options and source file set are unchanged. Language server keeps track of last compilation for a given entry point to provide oldProgram. Over time, it's possible that we can reuse more of oldProgram in more cases. * `CompilerHost` gains a new optional `parseCache` that allows sharing syntax trees between programs even if oldProgram is not supplied or the oldProgram didn't have a particular source file. This is particularly useful for language server features that do not need an entire program but just the syntax tree of the current document. The language server also uses this. * ParseOptions (currently include comments or not) can now be specified on `CompilerOptions`. Language server uses this to always include comments so that features that need comments can share trees with features that don't.
2022-08-24 17:36:05 +03:00
// Use empty node options and don't debug while profiling to get the most accurate timing
2023-02-16 01:37:39 +03:00
//"TYPESPEC_SERVER_NODE_OPTIONS": "",
Make syntax tree typing deeply readonly and reuse them in language server (#868) ## Summary * Make syntax trees deeply `readonly` in their TS typing. * Remove mutation of symbol tables contained in syntax trees in checker. * Reuse syntax trees for unchanged files in language server. * Reuse entire program when no files have changed in language server. * Fix other miscellaneous perf issues found while profiling the impact of this change: * Avoid repeat loading of config file * Avoid repeat creation of schema validators * Avoid unnecessary parse in findDocumentHighlight. * Add environment variables to log language server call timing and/or save .cpuprofile files to help with future perf work in this area. ## Performance I'm seeing approximately 2X less time spent in language server for typing the same sequence into petstore.cadl and navigating around with goto-definition, document-highlight. ## Details * We used to inject symbols into symbol tables hanging off syntax trees to implement using statements including the implicit `using Cadl` and member references. To avoid this, we now do a copy-on-write to the symbol tables. This adds an extra map lookup for each call to resolveIdentifierInTable, where we first look for a copy of the table and then do the actual lookup. No noticeable slowdown was observed in profiling based on this. It does double the time in resolveIdentifierInTable as 1 lookup becomes two, but this does not make a significant difference overall and I think it's a worthwhile trade to get the reuse. * `createProgram` gains a new `oldProgram` argument from which we will reuse syntax trees if the host gave us identical `SourceFile` instances. We will also reuse the entire oldProgram and skip checking if we find that the compiler options and source file set are unchanged. Language server keeps track of last compilation for a given entry point to provide oldProgram. Over time, it's possible that we can reuse more of oldProgram in more cases. * `CompilerHost` gains a new optional `parseCache` that allows sharing syntax trees between programs even if oldProgram is not supplied or the oldProgram didn't have a particular source file. This is particularly useful for language server features that do not need an entire program but just the syntax tree of the current document. The language server also uses this. * ParseOptions (currently include comments or not) can now be specified on `CompilerOptions`. Language server uses this to always include comments so that features that need comments can share trees with features that don't.
2022-08-24 17:36:05 +03:00
2023-02-16 01:37:39 +03:00
"TYPESPEC_SERVER_NODE_OPTIONS": "--nolazy --inspect-brk=4242",
"TYPESPEC_DEVELOPMENT_MODE": "true"
2021-08-25 22:47:06 +03:00
},
"presentation": {
"hidden": true
}
},
{
"type": "node",
"request": "launch",
"name": "Debug TypeSpec Migrate",
"program": "${workspaceFolder}/packages/migrate/dist/src/cli.js",
"smartStep": true,
"sourceMaps": true,
"skipFiles": ["<node_internals>/**/*.js"]
},
{
"type": "node",
"request": "launch",
"name": "Debug Docs Generation",
"program": "${workspaceFolder}/packages/website/.scripts/regen-ref-docs.mjs",
"smartStep": true,
"sourceMaps": true,
"skipFiles": ["<node_internals>/**/*.js"]
},
{
"name": "Run Web Extension in VS Code",
"type": "extensionHost",
"debugWebWorkerHost": true,
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/packages/typespec-vscode",
"--extensionDevelopmentKind=web"
],
"outFiles": ["${workspaceFolder}/dist/src/web/**/*.js"]
2021-08-25 22:47:06 +03:00
}
],
"compounds": [
{
"name": "VS Code Extension",
"configurations": ["VS Code Extension (Client)", "Attach to Language Server"],
"presentation": {
"order": 1
}
}
]
}