Граф коммитов

1070 Коммитов

Автор SHA1 Сообщение Дата
Timothee Guerin 90d84de1fb
Setup spell check and fix issues in markdown, ts and changelogs (#1000) 2022-09-09 19:54:18 +00:00
Brian Terlson 47893dc035
add install extension docs (#1014) 2022-09-09 19:32:22 +00:00
Timothee Guerin 2a22ba7e3a
Language overview summary (#1013) 2022-09-09 18:05:12 +00:00
Timothee Guerin e69902bb18
Language Basics: Decorators documentation (#1002) 2022-09-09 00:31:24 +00:00
Nick Guerrera 793189d80f
Fix duplicate test IDs (#999) 2022-09-08 21:35:08 +00:00
Timothee Guerin 3b8d075b86
Various docs: Versioning, friendlyName, etc. (#911) 2022-09-08 21:16:59 +00:00
Timothee Guerin 6fc20ad102
Validate that model and model are not model expression (#1004) 2022-09-08 20:30:29 +00:00
Timothee Guerin c7a655c468
Prepare cadl publish - September Sprint 2022 (#1001) 2022-09-08 17:24:39 +00:00
Timothee Guerin 4d0242c3d2
Deprecate @consumes @produces (#995) 2022-09-07 19:46:42 +00:00
Mike Kistler 840867dd83 Fix doc for route and move autoRoute to rest library 2022-09-07 10:32:48 -05:00
Nick Guerrera 9b087aebc8
Load extension when cadl.restartServer command is issued (#987) 2022-09-06 21:55:51 +00:00
Timothee Guerin f93f77cfa7
Fix style of tables in website docs (#985) 2022-09-06 19:20:31 +00:00
Timothee Guerin b0872d87e4
Update enum members to use a map (#953) 2022-09-06 12:02:02 -07:00
Brian Terlson 2e39db342b
Add basic library docs (#964) 2022-09-06 17:45:38 +00:00
Timothee Guerin 365bcccbaa
Operations & interfaces documentation (#976) 2022-09-06 17:09:49 +00:00
Timothee Guerin 187e5c9af2
Enum documentation (#975) 2022-09-06 09:46:31 -07:00
Timothee Guerin 478be3e4be
Feature: Projected names (#867) 2022-09-06 14:10:10 +00:00
Timothee Guerin e07d86c87a
Models documentation (#972) 2022-09-05 15:54:19 +00:00
Timothee Guerin e11440f0b4
Fix sidebar nav when in PR & Responsive ui in production build (#965) 2022-09-02 21:26:11 +00:00
David Wilson 13d8bcb69f
Guard against uninitialized parent type in `parentResource` (#966) 2022-09-02 07:43:45 -07:00
Timothee Guerin 24ca14abd3
Namespaces documentation (#963) 2022-09-02 05:17:36 -07:00
Brian Terlson c9f65532bf
fix docs site bug (#962) 2022-09-01 21:07:12 +00:00
Allen Zhang b32ca9911e
Update README.md
Remove .V3
2022-09-01 09:34:44 -07:00
Timothee Guerin bb5847a37d
Fix flickering playground on load & swagger ui not loading on first time (#957) 2022-08-31 15:10:43 -07:00
Timothee Guerin 8960cf1aba
Make docs section responsive + use a point of definition for toc of docs (#955) 2022-08-31 18:14:02 +00:00
Timothee Guerin 2327c17e90
Load swagger UI async (#954) 2022-08-31 17:43:44 +00:00
Timothee Guerin 0928e584c9
Upgrade to TypeScript `4.8` (#956) 2022-08-31 17:20:59 +00:00
Timothee Guerin ec1033091c
Try to unpin node (#952) 2022-08-31 16:52:13 +00:00
Nick Guerrera 872a3897bb
Fix symbol mutation in namespace merging (#951)
This would cause duplicate symbol errors to pile up in IDE when reusing
source files with merged namespace members.
2022-08-31 01:02:33 +00:00
Timothee Guerin f1fad76666
Cleanup global namespace uses (#950) 2022-08-30 14:54:31 -07:00
Timothee Guerin eb955d2fd7
Fix: Decorators not running in some template instance cases (#947) 2022-08-29 17:42:30 -07:00
Brian Terlson 1d982cca79
Add emitter docs (#945) 2022-08-30 00:12:03 +00:00
Timothee Guerin e3bb433c62
Fix various cases of decorators getting called on template declarations (#944) 2022-08-29 15:43:50 -07:00
Nick Guerrera 1a996e76a3
Fix off-by-one in range check for statement keyword (#943) 2022-08-29 21:42:52 +00:00
Nick Guerrera 59f88e9275
Make it easier to add tokens to scanner (#940) 2022-08-29 20:23:52 +00:00
Timothee Guerin 8a0b35d915
Resolve blank line added at the end of embedded code block (#936) 2022-08-29 18:02:20 +00:00
Timothee Guerin 057c124720
Cadl Website Initial Setup (#935) 2022-08-29 09:52:29 -07:00
Timothee Guerin 5e29ad9c0b
Fix deployed playground (#934) 2022-08-29 07:14:01 -07:00
Timothee Guerin ab758a71ac
Fix: Playground in safari (#930) 2022-08-26 19:30:45 -07:00
Timothee Guerin 8144321d1d
MIssing changelog from merge conflict (#931) 2022-08-26 14:37:58 -05:00
Timothee Guerin 645ceffed0
Remove internal program state for current projection (#861) 2022-08-26 18:41:37 +00:00
Nick Guerrera f6d64f7321
Don't overwrite template arguments to undefined on clone (#803)
Also, remove isStdType checks that were dead code behind
isTemplateInstance. If they were called, they would always return false
since we'd compare template instance `Array<Arg>` to the uninstantiated
`Array` type.
2022-08-26 18:15:55 +00:00
Jg1255 e7146d0256
Implementation of Hover Feature in Cadl (#876) 2022-08-26 17:46:39 +00:00
Nick Guerrera 4c58b8f0e9
Fix variable reuse caused by typo (#924)
The code works as is, but I did not intend to overwrite the value parameter
and doing so is very confusing.
2022-08-26 15:56:51 +00:00
Nick Guerrera 9b254b920e
Remove restriction on keyword length (#925)
We may need longer keywords for an upcoming feature. I micro-benchmarked and
saw only ~3% difference on scanning petstore.cadl ten thousand times. But
that's going from ~29us per scan to ~30us per scan and scanning is nowhere
close to a bottleneck in any real larger scenarios.
2022-08-26 15:32:58 +00:00
Brian Terlson 531d86bd34
Add a discriminated union sample (#919) 2022-08-25 22:19:15 +00:00
Nick Guerrera ca0513f840
Use configured cadl-server path in VS when using a solution (#920)
When a solution is open, there is no workspace, so we use the
solution folder as the workspace folder and read the settings
file ourselves.

Also fix an issue where there was not a good user-facing message
when cadl-server was configured to a path that did not exist.

Finally, some general cleanup:
* Downgrade 16.x VS API packages to 16.0 for maximum compatibility
* Upgrade other packages to latest
* Run VS format command to format #if blocks not formatted by `dotnet format`
* Run VS remove-and-sort-usings
* Add inner exceptions to our exception types
* Convert VariableResolver to static class
* Avoid checking development mode in two places
* Make helper types internal
* Seal classes where possible
* Use Dictionary.Add instead of indexer to get exception on duplicates
* Use TryGetValue instead of catch KeyNotFoundException
* Use exception filter instead of if+rethrow
* Use multiple args to Path.Combine instead of one with forward slashes to get OS-idiomatic paths.
* Use string instead of string[] for process arguments
  * It was confusing me that we sometimes put more than one argument in a single array element.
* Use `==` or `!= null` throughout instead of `is` and `is not`
  * I could go either way on this, but chose what we had most for consistency.
2022-08-25 12:04:57 -05:00
Brian Terlson 0a89618809
Implement discriminated unions (#837) 2022-08-24 14:36:19 -07:00
Nick Guerrera 33c2c4dc88
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 09:36:05 -05:00
Timothee Guerin c78697eb25
Feature: Projection formatting (#897) 2022-08-23 10:38:22 -07:00