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

2356 Коммитов

Автор SHA1 Сообщение Дата
Nick Guerrera b32bdf7f95
Prepare publish (#30) 2021-10-28 17:17:12 -05:00
Timothee Guerin 57eeed4723
Add OmitDefaults model to remove default values of a model (#27) 2021-10-28 16:58:12 +00:00
Timothee Guerin 8c9f62faca
Setup cadl prettier plugin to format samples and libraries (#26) 2021-10-28 16:51:44 +00:00
Nick Guerrera 43be41e127
Remove service host default (#20) 2021-10-27 14:41:04 -05:00
Timothee Guerin 870c028894
Tweak: Decorator formatting (#25) 2021-10-27 12:26:04 -07:00
Nick Guerrera d636ea1a48
Upgrade TypeScript and react to breaking change (#23)
We need to declare catch variables as `any` explicitly now (or turn it off
with a config, but I think it's fine like this). I noticed this because VS
Code defaults to its own version of TS and was reporting this error.

Also, some tests were expecting diagnostics to be exceptions still. Fixed,
including one test that was passing when it shouldn't have been as it had
not been updated to react to ADL -> Cadl rename or $ prefix of decorators.
2021-10-27 14:11:58 -05:00
Timothee Guerin fdd8694d35
Add multiple inheritance spec sample (#24) 2021-10-27 18:03:47 +00:00
Nick Guerrera 74246edb7f
Return non-zero exit code when compilation has errors (#21) 2021-10-27 12:31:44 -05:00
Timothee Guerin aa4eed3ad3
Feature: init lets you copy files with basic templating (#7) 2021-10-27 09:44:12 -07:00
Nick Guerrera 9b8cac3740
Fix interface colorization (#18) 2021-10-27 09:03:03 -05:00
Mike Kistler ef4e4e5412
Merge pull request #13 from mikekistler/fix-empty-enums
Fix crash on empty enum in openapi3 emitter
2021-10-26 13:22:48 -07:00
Mike Kistler 7f6ad9cc9a
Use strong typing on messageId
Co-authored-by: Nick Guerrera <nicholg@microsoft.com>
2021-10-26 12:21:23 -07:00
Nick Guerrera b673f1eeef
Fix `rush regen-samples` (#17) 2021-10-26 09:32:41 -05:00
JianyeXi 37c4e3aba0
Add lint rules (#5)
* add  option `--diagnostic-level` to specify which level of messages should be reported
* add docs for built-in types
* improve & export semantic-walk lib 

Co-authored-by: jianye xi <jianyxi@microsoft.com>
2021-10-26 10:23:07 +08:00
Mike Kistler 0ab32c1929
Merge pull request #14 from mikekistler/fix-param-default
Fix param default to be in schema
2021-10-25 18:55:55 -07:00
Mike Kistler 60cb1ab734 Define response body for primitive response type 2021-10-24 08:58:34 -07:00
Mike Kistler f729b9ebae Fix param default to be in schema 2021-10-24 07:09:16 -07:00
Mike Kistler c5bd22bc76 Fix crash on empty enum in openapi3 emitter 2021-10-23 16:36:26 -07:00
Mike Kistler 58513bbc64 Set shared param definitions in components.parameters 2021-10-23 14:25:23 -07:00
Mike Kistler 6d4ea0b6e9 Fix handling of decorators on parameters in openapi3 2021-10-23 09:13:36 -07:00
Mike Kistler 8cf60e89ac Add unit test for openapi3 parameter decorators 2021-10-23 09:13:36 -07:00
Mike Kistler a03572e6d4 Fix generation of openapi3 response headers 2021-10-22 18:13:29 -07:00
Mike Kistler 396a198619 Add test to reproduce issue with openapi3 response headers 2021-10-22 18:13:12 -07:00
David Wilson 521aebea55 Add @cadl-lang/samples with existing generic samples 2021-10-21 09:24:03 -07:00
Nick Guerrera 2c5454dc1a Port build process to new OSS repo 2021-10-19 15:21:39 -05:00
Timothee Guerin 6a52d07ef9 Fix `using` formatting (#866) 2021-10-19 09:26:58 -07:00
Timothee Guerin e62aad12a0 Introduce logger to allow logging information (#865) 2021-10-18 13:46:01 -07:00
Timothee Guerin 8246666f6c Strict diagnostics in the compiler (#845) 2021-10-15 15:06:34 -07:00
markcowl b22d8ec3da Preparing package changes for release 2021-10-15 14:34:50 -07:00
Timothee Guerin 3e3bae0ebb Feature: Suppress warnings (#826) 2021-10-13 08:38:07 -07:00
Brian Terlson 1bf3922cf5 add more interface polish: walker, colorization, printer (#841) 2021-10-12 16:55:10 -07:00
Brian Terlson 04b0927a44 Implement union declaration (#832) 2021-10-11 15:38:20 -07:00
Timothee Guerin c3ce1d3256 Feature: Add support for defaults for optional properties and parameters (#825) 2021-10-08 07:42:15 -07:00
Timothee Guerin 817eb76f5c Directive parser, tmlanguage and formatter (#805) 2021-10-07 12:55:11 -07:00
Timothee Guerin ccc8de9866 Typed diagnostics for libraries (#795) 2021-10-07 12:54:58 -07:00
Brian Terlson 04a04bbe50 Implement interface (#816) 2021-10-07 09:53:36 -07:00
Brian Terlson 2cf9d6f94a Implement a clone type API on checker (#813) 2021-10-01 11:17:23 -07:00
David Wilson d8fafe8032 Merge pull request #807 from daviwil/library-namespaces
Move cadl-rpaas types and decorators into Azure.ARM namespace
2021-09-30 15:55:57 -07:00
Brian Terlson 6fac2f6a0b Reverse order of decorator evaluation (#793) 2021-09-30 13:36:37 -07:00
markcowl 7d3c79ffcb Fixing out of date comment 2021-09-29 15:34:58 -07:00
markcowl c69fd154ba Defensive code to prevent language server failure 2021-09-29 15:02:01 -07:00
David Wilson 537482d287 Ensure that binder synthesizes the namespace correctly 2021-09-28 10:54:07 -07:00
Nick Guerrera db1bb440f8 Run decorators and onBuild handlers in language server (#804)
We now run decorators and onBuild handlers in the language server and
thereby show their diagnostics to the IDE user as they code.

This put pressure on the issue of getting mismatched compiler versions since
it becomes a common case where the Cadl being edited pulls in a local
version that is different from the global version used by the global
cadl-server.

We now implement a check that resolving @cadl-lang/compiler from the entry
point cadl file either doesn't resolve or resolves to the same location as
the current compiler. If this check fails, compilation is aborted early with
a diagnostic error. The error message discusses two common causes: running
on the command line from a working directory away from the source or running
in the IDE where the root workspace dir is not the one with the node_modules
that have the cadl compiler package.

In the second error case, the recommended remedy in the message is to
configure the cadl-server path in IDE settings. We actually have this
case (which an end user can also have) in our own repo and this change also
configures our VS Code settings to use the local cadl that we are developing
on.
2021-09-24 12:45:09 -05:00
Brian Terlson dadf721c05 Fix ns bugs (#803)
Fix binding of JS files.
Fix namespace decorators referencing other namespaces.
2021-09-23 15:36:36 -07:00
Brian Terlson b2680195ca Fix using bug when using'd namespace is merged after current namespace (#790) 2021-09-22 16:31:30 -07:00
Nick Guerrera 600c72d1a6 Revert accidental change that started running decorators/onBuild in LS (#784)
A mistake during a refactoring caused us to start running decorators and
onBuild in language server. We do intend to do this soon, but doing it
prematurely revealed a version problem where we can't safely run decorators
that load a local Cadl compiler while using the globally installed language
server.

So, for now, revert back to not running decorators, and we will look at how
to deal with the version mismatch as part of doing it again deliberately.
2021-09-22 12:52:14 -05:00
markcowl 22664b5edd Publish cadl September features 2021-09-16 17:51:24 -07:00
markcowl 88da52a3ec Fixing changelog in openapi3 package 2021-09-16 17:31:32 -07:00
Brian Terlson 797589fdff Move builtins into cadl namespace, merge namespaces in checker (#766) 2021-09-14 11:56:37 -07:00
Nick Guerrera 9d8dd51a6c Fix bug preventing using latest changes to document in IDE (#758)
IDE features were not seeing latest revision of a document unless
it was untitled due to a typo in the code.
2021-09-10 11:45:21 -05:00
Timothee Guerin ad9a8e39de Feature: `cadl init` command (#707) 2021-09-10 08:55:13 -07:00
Brian Terlson 49df4cf6cd Remove multiple inheritance (#759) 2021-09-10 08:53:27 -07:00
Timothee Guerin 0452a33467 Semantic walker (#715) 2021-09-09 10:34:45 -07:00
Brian Terlson 7891561347 Change `byte` to `bytes`, add various int formats (#755) 2021-09-08 14:54:14 -07:00
Nick Guerrera e192b96caa Ensure syntax nodes report correct and consistent source positions (#754)
Code used in go-to definition depends on the invariant that a node's `[pos,
end)` range must be inside that of its parent. This invariant may prove
useful for other purposes too. However, there were some places where this
invariant did not hold and this change fixes that.

1. Statements did not include decoroators (if any) inside their `[pos, end)`
range. Incosistently, parameters, model members, and enum members did
already include decorators in their position. This change includes
decorators in positioning always.

2. Member expression positioning was incorrect and started at the position
of the last identifier rather than the start of the full member expression.

3. Namespaces using the `namespace A.B.C {}` syntax that expanded to
`namespace A { namespace B { namespace C {}}}` started the inner namespaces
at their identifiers. The only way to keep this invariant is to have all the
namespaces defined have the same `[pos, end)` range of the entire statement,
so this change does that.
2021-09-08 16:53:35 -05:00
Nick Guerrera b111bd337a Implement go-to-definition in language server (#750)
Also fix bug that broke analysis of untitled documents
2021-08-30 17:41:23 -05:00
Mike Kistler 0b024d674c Add emitter for OpenAPI 3.0 (#745) 2021-08-27 10:25:58 -05:00
Nick Guerrera d28a30a7a9 Use current tmlanguage-generator package (#744)
We were still pulling the package pre-rename from npm instead of
linking to the one in the repo with a new name.
2021-08-25 15:09:03 -05:00
markcowl df3b1b458a Updates for cadl release 0.19.0 2021-08-20 17:05:19 -07:00
David Wilson 91da40cca2 Introduce naming convention `$name` for JS-defined Cadl functions 2021-08-19 15:43:22 -07:00
markcowl afdf37df95 Publish _____ fixes 2021-08-13 12:11:19 -07:00
markcowl 26e7e9e8c8 Updatable -> updateable 2021-08-13 00:17:45 -07:00
markcowl c9eb9081cf Merge branch 'main' of github.com:azure/adl into demo 2021-08-12 16:02:17 -07:00
Nick Guerrera 897476ce91 Remove client generation command (#721) 2021-08-12 12:30:43 -05:00
Nick Guerrera 0ce25f4aa9 Fix `cadl vs uninstall` (#720)
It was throwing `YError: Invalid third argument. Expected function or object but received undefined.`
2021-08-12 10:28:30 -05:00
Nick Guerrera d117e1ac74 Rename packages in preparation for OSS release (#714) 2021-08-12 08:38:20 -05:00
markcowl 6ea0ee86b6 remove unnecessary code, fix empty response schema emission, and correct tests 2021-08-11 18:55:20 -07:00
markcowl b8a81cfef9 Merge branch 'main' of github.com:azure/adl into demo 2021-08-09 15:40:36 -07:00
David Wilson (AZURE SDK) 1c45a24904 Prepare Cadl v0.16.0 release 2021-08-09 14:15:40 -07:00
David Wilson (AZURE SDK) ddffd91688 Add `compile --watch` option to watch file changes and recompile 2021-08-09 11:29:53 -07:00
markcowl 889794028f adjust to rename for cadl 2021-08-05 17:02:05 -07:00
Timothee Guerin e94a492ab2 Update to yargs 17 and args parsing to use handler system. (#696) 2021-08-03 10:49:49 -07:00
Brian Terlson ecd98a6cdd Don't allow duplicate model and enum members (#697) 2021-08-03 10:38:14 -07:00
Brian Terlson 07949f4949 Implement model is support (#691) 2021-08-02 18:27:07 -07:00
Nick Guerrera 013db35e87 Prepare publish of Cadl v0.15.0 (#688) 2021-08-02 13:25:21 -05:00
Nick Guerrera 8e0f6be0f4 Rename ADL to Cadl (#678) 2021-08-02 13:14:53 -05:00
markcowl 7d8dbad264 Merging in generator changes 2021-07-29 15:56:42 -07:00
markcowl 2d680111b7 Publish packages for bug fixes and controller generator 2021-07-28 12:42:48 -07:00
markcowl d61e6e6b1b Responding to review feedback 2021-07-27 21:23:45 -07:00
markcowl f0ab71d9ec Adjusting to new decorators property on types 2021-07-27 11:54:34 -07:00
markcowl 28e9b96c85 Merge branch 'main' of github.com:azure/adl into adl-gen-update 2021-07-27 11:11:57 -07:00
markcowl 8e47296b6f fix commits 2021-07-27 11:11:01 -07:00
Brian Terlson 254262ce57 Allow decorators to go in namespaces. (#662)
* Refactor decorator binding out of program and into binder
* Refactor decorator execution out of program and into checker
* Decorators can have a .decorator string property with a namespace like A.B on it.
* js files can export a namespace property which has a namespace like A.B in it.
* Decorators and types occupy separate namespaces so can have the same name.
2021-07-26 10:09:31 -07:00
markcowl c2f2548ff1 Update formatting 2021-07-25 14:21:02 -07:00
Nick Guerrera 2fad9f7307 Improve unicode support in lexical structure (#673)
1. Define and implement UAX31.R2 Immutable Identifiers profile
2. Normalize identifiers to NFC
2021-07-23 10:19:21 -05:00
markcowl 66240715d2 Removing unnecessary files, cleaning up changes in adl-openapi 2021-07-22 18:11:35 -07:00
markcowl 94ec19e31d mergining with upstream 2021-07-22 17:18:12 -07:00
Nick Guerrera 5055d411fb Bump autorest version to get client gen test to pass (#675)
Also remove unnecessary `npm link` step that made running more than once on my
machine fail.
2021-07-22 15:09:12 -05:00
markcowl 03be3938d9 Merging in adl-openapi bug fixes 2021-07-11 18:34:34 -07:00
Nick Guerrera 68361251ad Prepare 0.13.0 release (#654) 2021-07-09 13:33:50 -07:00
Nick Guerrera fd57be627b Add semantic analysis to language server (#608)
Previously, the language server only parsed files and only reported
diagnostics from parse errors. Now it runs a compilation and reports
semantic errors such as unknown identifiers in open files.

For now, decorators are not invoked nor is onBuild called. There are some
unresolved design issues there still to be discussed...

The language server will try to infer the appropriate entry
point (a.k.a. "main file") for a given document. This is necessary because
you can get different diagnostics in the same files for different entry
points.

The entry point inference is not perfect and there can be unexpected
diagnostics if the imports are done sufficiently creatively to outsmart
it. It works by walking the directory tree from the changed document through
its parents and stopping when a package.json with adlMain or main.adl is
found or we reach a workspace root. If we reach a workspace root without
finding an entry point, then the document is used as its own entry
point. Untitled documents are always analyzed as their own entry points
since they do not exist in any directory where another entry point could be
found.

At some point, we may need to add some configuration to be explicit about
which entry points to use at some point, but the inference should also be
sufficient for common cases. For example, it is sufficient enough to handle
all of our samples.

Additional minor changes:

1. Fix an issue where spreading a property that had an unbound decorator
would report duplicate diagnostics at the same source location indicating
that the decorator could not be found.

2. Route config file I/O through compiler host interface.

3. Fix an issue with debugger config where VS Code was sometimes failing to
attach to language server.
2021-07-09 13:19:56 -07:00
Nick Guerrera bbcbaf3cd7 Merge pull request #600 from daviwil/fix-rpaas-linter-failures
Fixes for a few Swagger linter violations for ARM RPaaS output
2021-07-09 10:21:37 -07:00
Nick Guerrera d2d6e4a066 Remove duplicate types, unused properties (#638) 2021-07-08 14:55:52 -07:00
Timothee Guerin 04c18a00d4 Feature: Auto-fromatter can handle recoverable parsing error (#622) 2021-07-07 12:08:56 -07:00
markcowl a2e79d3854 Merging with upstream 2021-06-29 17:36:01 -07:00
Timothee Guerin f7e13664e9 Diagnostics code as string (#601)
* Change diagnostic code to be a string

* Changelog

* Remove ADL prefix
2021-06-29 11:06:43 -07:00
Nick Guerrera 5c349e7eed Use LSP to log messages from client to server (#598)
This removes the need for a custom output window pane in Visual Studio.

Also, start tracking workspace folders which will be needed soon, but just
log them for now.
2021-06-25 06:54:53 -07:00
David Wilson 55371b467a Generate RPaaS update op with all resource properties optional 2021-06-25 14:01:40 +03:00
David Wilson 5fd38c3f4e Prevent OpenAPI emitter from tripping on ErrorTypes in ADL output 2021-06-25 14:01:40 +03:00
David Wilson ade121ad67 Prepare ADL packages release 2021-06-24 06:58:07 +03:00
David Wilson f8ca46757b Merge pull request #591 from daviwil/fix-path-parameter-decorators
Fix application of intrinsic decorators to properties and parameters
2021-06-23 20:38:06 +03:00
David Wilson abd388c334 Fix application of intrinsic decorators to properties and parameters 2021-06-23 13:50:56 +03:00
Nick Guerrera ff086dd933 Add support for Visual Studio 2022 (#588)
This required splitting things into separate VSIXes per guidance here:

https://docs.microsoft.com/en-us/visualstudio/extensibility/migration/update-visual-studio-extension?view=vs-2022
2021-06-22 09:20:39 -07:00
markcowl 8ff1311033 Updating for new stored state maps 2021-06-21 20:50:55 -07:00
markcowl 2a4b85b888 Merging with main 2021-06-21 18:59:59 -07:00
David Wilson f2da3d1f5a Binder now uses reportDuplicateSymbols from Program 2021-06-21 08:16:31 +03:00
David Wilson f093f5c4f8 Pass along diagnostics raised by parsing mutation grafts 2021-06-21 08:16:31 +03:00
David Wilson (AZURE SDK) 630d6c3b0d Add mutators library for manipulating evaluated ADL types 2021-06-21 08:16:31 +03:00
Timothee Guerin 34ea3a669a Feature: ADL Program types walker (#586) 2021-06-18 09:43:28 -07:00
markcowl 341baba352 Updating with latest fixes 2021-06-15 22:04:05 -07:00
markcowl 8c8917adda Fixes for swagger gen issues 2021-06-10 20:04:32 -07:00
Nick Guerrera 2ec0c6c455 Bump TypeScript version (#582) 2021-06-10 11:16:34 -07:00
Nick Guerrera f04292734a Handle untitled source files in VS Code (#581)
Previously, there was no feedback from language server unless a document
had was written somewhere to disk at least once. Feedback happened live,
not on save, but if the document was "untitled", then there would be no
feedback at all.
2021-06-10 10:55:46 -07:00
markcowl 9d596f6c83 Fix issues over model generation 2021-06-08 14:18:55 -07:00
Nick Guerrera 8518a0bd17 Use same entry point handling for compile and import (#577)
We no longer glob files when a directory is passed to `adl
compile`. Instead, we will look for `adlMain` specified by package.json or
main.adl in the directory. This eliminates any dependency on file system
enumeration order and will make it easier for tooling to implement semantic
features.

Also:
* Fix various issues with reporting I/O errors as diagnostics.
* Fix issue where regen-samples would silently pass PR validation if nothing
  at all was emitted.
* Make regen-samples have opt-out exclude list instead of opt-in include
  list.
* Report correct location for syntax errors in decorators, and fix issue
  with copying petstore sample to another folder without type: module in
  package.json
* Allow .mjs extension for decorator imports.
* Make sure unahndled promise rejection becomes internal compiler error.
* Fix issue with dumping config with diagnostics from `adl info`
* Avoid repeating config filename in `adl info`
2021-06-04 14:12:59 -07:00
Nick Guerrera c62c1036f9 Add semantic error recovery (#574)
We now continue to semantic analysis when there are parse errors, and we do
not abort the compilation when a semantic error is encountered, but instead
recover and look for more errors.

DiagnosticError is no longer a thing as we never throw diagnostics as
exceptions anymore. throwDiagnostic is now Program.reportDiagnostic.
2021-06-03 08:46:10 -07:00
markcowl ba3de996f6 Implementation to visit all operations and models 2021-06-02 21:59:11 -07:00
Nick Guerrera 451274c269 Facilitate merge of config file loading with semantic error recovery (#572)
It ended up being tricky to merge my pending semantic error recovery change
with the config file loading change. This change extracts out some changes
to config file loading from my error recovery branch as it will be easier to
review this independently from that.

* Don't bother making a diagnostic for incorrect file extension, as compiler
  should never attempt that. It's OK to throw a regular error in this case.
* Fix issue with returning or spreading default config where mutation of
  loaded config could mutate defaults.
* Avoid fileExists + readFile race condition by not using fileExists and
  catching readFile ENOENT error instead.
* Move extra json file for multi-file test to correct folder.
* Various small refactorings to make these changes easier.
2021-06-02 15:20:45 -07:00
Nick Guerrera d2658c5e33 Run prettier plugin test in CI and mocha explorer, fix test bug (#570) 2021-05-27 09:09:14 -07:00
Timothee Guerin 62da05403d User Configuration file discovery and loading (#562) 2021-05-27 08:33:39 -07:00
Nick Guerrera 0ce71bfb7e Prepare publish of v0.11 (#561) 2021-05-18 17:58:38 -07:00
Timothee Guerin 1a34119e65 Throw diagnostic error when main adl file is not found. (#560) 2021-05-18 14:58:52 -07:00
Nick Guerrera 9427591bfe Work around npm 7+ Mac OS bug in `adl code install` (#557) 2021-05-18 14:32:50 -07:00
Nick Guerrera 8ab8f8a6c3 Prefer local install of adl package when running global `adl` (#552)
Prevents conflicts between two copies of adl modules in global and local
package locations.
2021-05-18 14:22:37 -07:00
Nick Guerrera cc90a5b228 Don't fallthrough from `adl vs` to `adl format` (#558) 2021-05-18 09:21:33 -07:00
Timothee Guerin 469b1457f4 Formatter: Multiline string (#555) 2021-05-14 10:23:32 -07:00
Timothee Guerin bb82633b6c Fix: Don't format a file that has parsing errors (#549) 2021-05-13 15:57:33 -07:00
Nick Guerrera bf53463205 Remove some unused types (#550) 2021-05-13 11:38:31 -07:00
Timothee Guerin 96de03678a Fix: Formatter not rendering template parameters of models. (#548) 2021-05-13 09:42:25 -07:00
markcowl 2651269740 making first typescript based generator 2021-05-12 22:36:30 -07:00
Nick Guerrera d7bda1f5d9 Fix issue launching adl-server on Mac OS (#547)
We were clearing environment variables down to one environment variable
rather than adding one for node options.
2021-05-12 13:27:49 -07:00
Timothee Guerin 69a6b60cab ADL prettier plugin and `adl format` command (#511)
Added a new package prettier-plugin-adl providing adl support to prettier. Just installing the plugin next to prettier will automatically enable it for .adl files.

Added new adl format command.

Usage:

adl format **/*.adl

This will format all the files matching the pattern.
2021-05-12 09:46:58 -07:00
Nick Guerrera 3f58a55bc3 Prepare publish of adl 0.10.0 (#544) 2021-05-06 08:27:14 -07:00
Brian Terlson 261465f0dd Make blockless namespaces accumulate declarations. (#543) 2021-05-05 13:11:35 -07:00
Nick Guerrera d1401ef065 Don't warn on developer builds without VS (#521)
The warning was breaking `rush dogfood`
2021-05-03 16:56:45 -07:00
Nick Guerrera efe9479cd4 Clean up editor settings (#519)
1. Move to per-language prettier formatter throughout. Global wasn't working
for some folks for TypeScript, so I suspect it's best to use the
per-language setting throughout.

2. Merge the adl-vs .editorconfig into the root .editorconfig, giving better
defaults for editors other than VS Code that support .editorconfig.

3. Add ADL, C# and XML to VS Code settings.json
2021-05-03 15:39:09 -07:00
Nick Guerrera d4924d88a6 Add describe prefix for better test navigation in IDE (#518)
Also fix a mistaken test grouping due to incorrect merge conflict resolution
2021-05-03 14:59:30 -07:00
Nick Guerrera 932c8bdc31 Disallow mocha .only in CI and PR validation (#516) 2021-05-03 12:51:18 -07:00
Nick Guerrera 7c6ef01053 Do not allow non-triple-quoted strings to be multi-line 2021-05-03 11:57:25 -07:00
Nick Guerrera 44faaadf01 More scanner optimization and fixes
* Don't allocate substrings to match keywords.
* Make at most one pass over string to get its unquoted/unescaped/unindented
  value. (**)
* Add test coverage for impacted code paths.
* Fix issue where string value of an unterminated string was missing final
  character(s) in string value.

(**) Actually, we still make two passes in the case of a non-triple-quoted,
multi-line string with \r\n, but that is about to be removed by the next
commit which will disallow non-triple-quoted, multi-line strings
altogether.
2021-05-03 11:57:18 -07:00
Nick Guerrera 158dd31eb2 Merge pull request #513 from nguerrera/test-explorer-issue-doc
Document test explorer issues and workaround
2021-05-03 11:39:51 -07:00
Brian Terlson 8c86e04427 Implement alias and enum, remove model = (#504) 2021-05-03 11:14:24 -07:00
Nick Guerrera dcb8f16cbd Guard against fuzz tests being run accidentally 2021-05-03 09:25:30 -07:00
Nick Guerrera 051862aa54 Fix some end-to-end client generation issues (#507)
1. `compile` had lost its success message. I inadvertently deleted it
   a while ago: restored.
2. `generate` was printing undefined as the output path: fixed.
3. `generate` did nothing without --client, required --client for now.
4. `generate` took a long time to do nothing without --language,
   required --language.
5. `generate` a client inside the adl tree, and tsc would to compile
   it: excluded 'adl-output' in tsconfig.

Also routed running of autorest through run helper so you can see the
autorest args we pass using `adl --debug`
2021-04-28 13:31:31 -07:00
Nick Guerrera b93b561fc4 Allow leading +/- in numeric literals and require fractional digits (#503) 2021-04-28 08:02:54 -07:00
Nick Guerrera 9bda6a8fc9 Inform tsc of project-to-project dependencies (#495)
Fixes issues with watch build when a change impacts dependent
projects.

Also fix issues preventing a watch build in VS Code from being
successful due to dist/ or dist-dev/ not being created yet.

With both of these, it is now actually possible to do only rush
update on pristine enlistment, then Ctrl+Shift+B in VS Code as
CONTRIBUTING.md claims.
2021-04-26 14:33:08 -07:00
Nick Guerrera fa575e515e Optimize finishNode calls in parser
Spreading the 3 finishing values turns out to be noticeably cheaper
than spreading the unfinished node.
2021-04-26 08:29:14 -07:00
Nick Guerrera 3ac9719b17 Allow ZWJ and ZWNJ to continue identifiers as specified 2021-04-26 08:29:13 -07:00
Nick Guerrera 5fb28d6378 Fix scanning edge cases and optimize slightly
* Bug fixes
  * tokenValue() was wrong if an identifier ever came right after a
    string literal.
  * There was an incorrect and confusing end-of-file error if file
    ends with numeric literal. Generally hardened and cleaned up EOF
    checking throughout.
  * Digits weren't allowed in identifier with non-ascii characters.

* Perf
  * Add more ASCII fast paths
  * Inline scanUntil everywhere, and simplify each use to what it
    actually needed
  * Avoid eager substring allocation and map lookup for keywords in
    more cases
2021-04-26 08:27:08 -07:00
Nick Guerrera 9063e1b63f Include error code in messages sent from language server 2021-04-25 15:36:30 -07:00
Nick Guerrera 63858dae30 Run ecmarkup with --strict 2021-04-25 15:36:30 -07:00
Nick Guerrera df4b13e4c7 Use `===` 2021-04-25 15:36:30 -07:00
Nick Guerrera a60e5c2096 Pass along warnings and actually write out spec in watch build 2021-04-25 15:36:30 -07:00
Nick Guerrera 8ba26ec85b Rename CharacterCodes to CharCode and use Pascal case for members
Also re-group members with comments
2021-04-25 15:36:15 -07:00
Nick Guerrera 586018e47b Shorten charcode filename 2021-04-24 12:27:26 -07:00
Nick Guerrera c708698a5d Shorten nonascii source file and script names 2021-04-24 12:20:44 -07:00
Nick Guerrera 5de3f5347b Check in a script to regenerate non-ascii identifier maps (#483) 2021-04-23 15:55:31 -07:00
Nick Guerrera 3b35f162c1 Use compilerAssert/throwDiagnostic as appropriate (#480) 2021-04-23 14:19:45 -07:00
Nick Guerrera 848bbd22af Deal with slower CI on Windows (#476)
* Bump mocha timeout from default 2s to 5s
* Run nuget restore in a separate step for better telemetry
2021-04-23 13:46:20 -07:00
Nick Guerrera eef42ffbdf Add API to check if a node or any descendants have parse errors (#479)
* Put empty statements and invalid statements in the tree. We now have
  an invariant that if there is a parse error, there must be a node in
  the tree with an error, and even empty statements can have errors if
  you try to decorate one. All parse tests now check this invariant.

* Refine dumpAST to sort in a more readable order and to print the
  substring of source code with each node.
2021-04-23 13:08:18 -07:00
Nick Guerrera 3a4d123075 Speed up parseExpectedOneOf (#475) 2021-04-22 17:49:54 -07:00
Nick Guerrera 78661fdbe8 Fix bugs with non-ascii identifiers (#474) 2021-04-22 13:13:32 -07:00
Nick Guerrera ea281c601c Convert remaining `<T>` casts to `as T` (#466)
The regex I used in the last round was flawed and missed these.

Also remove some casts where possible, and change TypeInstantiationMap
set function's return type from string to void.
2021-04-21 09:48:52 -07:00
Nick Guerrera 55e7d5e88a Use type checking instead of runtime assert for surrounded list req (#467) 2021-04-21 09:48:37 -07:00
Nick Guerrera 02b84e5857 Stop fuzz test from accidentally running in CI (#463) 2021-04-21 07:34:18 -07:00
Timothee Guerin 4914101cd5 Add NoContentResponse and update CreatedResponse to allow body (#385)
* Add NoContentResponse and update CreatedResponse to allow body

* Add changes

* Remove body from created

* .

* .
2021-04-21 06:39:27 -07:00
Nick Guerrera 5ad8a45c39 Remove dependencies from types.ts to implementation files (#458) 2021-04-20 19:06:35 -07:00
Nick Guerrera 473a04e35a Exclude tests from npm packages (#465) 2021-04-20 16:29:32 -07:00
Nick Guerrera 7414661e5a Import from Types without prefix in parser (#464) 2021-04-20 15:51:28 -07:00
Nick Guerrera bc216196db Add `npm run fuzz` to run parsing fuzz test (#462) 2021-04-20 15:17:56 -07:00
Nick Guerrera db4535a2f3 Use T[] for arrays and as T for casts throughout (#461) 2021-04-20 14:44:19 -07:00
Nick Guerrera 047920f606 Run prettier to organize imports 2021-04-20 11:10:19 -07:00
Nick Guerrera c807d980ba Use prettier organize imports plugin
Also remove unused dev dependencies from **/package.json
2021-04-20 11:01:06 -07:00
Nick Guerrera 223ecb6a7a Fix typo (#455)
Real position of last error should be initialized to an impossible value.
2021-04-20 09:18:07 -07:00
Nick Guerrera a6d9bc552c Implement basic parser error recovery (#453)
With this change, the parser no longer throws when it encounters an
error, but continues on to report subsequent errors to the user as
well.

For now, however, evalADLScript still throws if there are any parse
errors. More work is needed in the parser to represent which nodes
have the errors and so forth before we can meaningfully analyze a
syntax tree for source that had errors.

Our default response to a token that doesn't match our expectation is
to insert a matching token before the offending token. This is
effectively what is happening wherever we have parseExpected() without
checking the return value. Also when we expect an identifier and do
not find one, we insert an identifier with a unique yet unspeakable
name. In fact, anywhere we hit an invalid expression, we insert one of
these identifiers.

Statements are easier to correct than expressions, and our approach
there is different. Every statement in the language begins with a
reserved word, an at-sign, or a semicolon. If the leading token for
statement is none of these, we report an invalid statement starting at
that token and ending immediately before the next token that is one of
these.

There are also case-by-case refinements to this insertion
strategy. For example, we replace errant semicolons with commas in
comma-only delimited lists rather than inserting semicolons in front
of the comma.

In other cases, we take the approach of parsing a grammar that is a
superset of the language specification, augmented with known common
errors. For example, we parse decorators in many more places than
actually allowed (and signal an error still, of course). We do the
same for import statements inside namespaces.

Over time, I expect that we'll need to do more of these more
deliberate and one-off corrections, but this change still performs
relatively well and it provides the foundation for such improvements.

A major challenge with the approach of correction by inserting tokens
is that it can hang the parser such that it keeps inserting tokens
without making forward progress. To mitigate the risk of such bugs,
all list constructs that are susceptible to this are driven by the
same parseList() routine. This routine has an escape hatch in the loop
where it bails and assumes we've hit a bad representation for the end
of the list if any loop iteration fails to make progress.

A trivial example of a construct that would hit this without this
check is `model M { ]`. The parser proceeds as follows in that case:

1. Parse model keyword: OK.
2. Parse model name (M): OK.
3. Parse open brace: OK.
4. Expect property name, see close bracket: ERROR, insert synthetic
   identifier for property name.
5. Expect colon, see close bracket: ERROR, insert colon.
6. Expect property type, see close bracket: ERROR, insert synthetic
   identifier for property type.
7. Expect semicolon, see close bracket: ERROR, insert semicolon.
8. Observe that the position has not advanced after a full loop
   iteration of parsing properties: ERROR, replace with close brace,
   exit loop.

(Note that everywhere I'm saying "insert" or "replace" here, there's
no literal array of tokens that we're mutating, we are just taking the
code paths we would take if those edits were made to the source. There
is rather an implicit "behave as though" replacing/inserting, but that
is really an implementation detail and not part of the logical
algorithm.)

Without the vital step 8, we could convince ourselves that we've
parsed a real property and try to move on to the next one, and do this
over and over again, creating infinitely many synthetically named
properties of synthetically named types!

This change also adjusts many of our error messages, borrowing from
the TypeScript compiler's terse tone for mundane errors.

It also fixes various issues with imprecise or sub-optimal squiggly
locations for various errors.

There are also some ADL team developer productivity improvements in
this change...

The per-test output in Mocha Test Explorer in VS Code now shows the
input source code, the resulting syntax tree, and all parse
diagnostics formatted nicely as the CLI compiler would. The syntax
tree JSON also has boilerplate default-empty things elided and the
start and end positions augmented with line and column number.

Negative parse test cases must now provide regex(es) to match against
the reported diagnostics.

Stack traces in Mocha Test Explorer will now be reported up to 50
frames rather than 10, making it easier to diagnose a stack overflow
in the parser's recursive descent.

A new compilerAssert function is added for asserting something that
should never happen in the compiler. It takes a condition, message,
and optional source node. If the condition is not met, it throws an
AssertionError with the message and if a source node is provided, the
message will be augmented with "occurred while compiling (file) near
line (X) and column (Y)". This is used in only a couple of places
right now. I did not yet scrub the existing throws that could benefit
from this.

If a DiagnosticError or AggregateError occurs in a test, the formatted
diagnostics or inner stack traces are included in the Mocha Test
Explorer per-test output. This is done because tests don't have the
CLI catch handler that has to take special steps for these special
errors.

Note that for all Mocha Test Explorer output improvements above, if
you prefer to run tests on the command line, you can also set
environment variable ADL_VERBOSE_TEST_OUTPUT=true and get all of the
output spewed to the console.

An issue with the typing of `messages` allowed typos when used is
fixed, and the fix makes `Message.X` a `Message` and if you hover over
X in the IDE, you will see the message code, severity and text.

Finally, there's also a minor correction in the tutorial to account
for parenless decorators having been removed from the language.
2021-04-20 09:04:45 -07:00
David Wilson 56d97cba06 Prepare release for ADL 0.9.0, etc 2021-04-20 08:24:59 -07:00
Nick Guerrera 73f89b51a0 Small test infrastructure improvements
* Update to latest mocha

* Use source-map-support to get .ts in stack traces.

  This is supposed to also allow mocha explorer to navigate to .ts,
  but it isn't working. :(

* Enable verbose test logging when run through mocha explorer where
  the output is associated with individual tests and spam is not a
  concern. Prevents needing to uncomment code to investigate failures.
  On the command line, you can also set ADL_VERBOSE_TEST_OUTPUT=true
  in the environment to get all of this logging to the console.

* Set things up to allow more than one project in mocha explorer
2021-04-15 10:37:23 -07:00
Nick Guerrera 31fa512b67 Bump typescript version in one project that was missed 2021-04-15 10:30:20 -07:00
Timothee Guerin ca772c1b3e Add writeFile to CompilerHost to virtualize writing output. (#442) 2021-04-15 10:28:53 -07:00
David Wilson 94db077ee3 Merge pull request #436 from daviwil/arm-modelling-redesign
Redesign ARM service modelling to cover many more cases
2021-04-15 08:41:31 -07:00
David Wilson 6380ce6a02 Redesign ARM modelling using new @armResource decorator
- Add new @armResource, @armResourceOperations, and @armStandard* decorators
- Add new base types for ARM resources: TrackedResource, ExtensionResource, ProxyResource
- Trim base service namespace from parameter definition names
- Fix issue where dynamic namespaces were not evaluated
- Add _____ sample
- Add _____ sample
- Update _____ and _____ samples
2021-04-15 08:35:42 -07:00
Brian Terlson bd3934b7fb Implement optional prefix | and &, fix trailing comma bug (#446) 2021-04-14 09:57:08 -07:00
Nick Guerrera 7eb3b821a7 Update typescript, allow VS Code to use workspace version (#444) 2021-04-13 12:58:36 -07:00
Nick Guerrera 4d9257d900 Improve diagnostics for out-of-date VS install (#443)
* Warn if VS has older than minimum required version, and skip local build
* Ensure more descriptive warnings and errors go to `rush` summary output
* Add escape hatch ADL_SKIP_VS_BUILD env var to force VS build to skip
2021-04-13 12:38:51 -07:00
Nick Guerrera 616642b607 Housekeeping (#439)
* Add LICENSE file to root and all packages

* Standardize tsconfig.json files, invert default to esnext

* Standardize package.json files, putting metadata first, impl last

* Reduce number of stub package.json files for type=module by putting
  type=module one-level up where possible

* Standardize dependency version ranges: ~ to external, exact for
  adl-* to adl-*. The latter is a prerelease policy to avoid having to
  debug mismatches while things are churning and breaking frequently.

* `rush update --full` to pick up patches of our dependencies

* Use consistent casing for CONTRIBUTING.md and README.md

* Fix squigglies on some rush json files with comments in VS Code

* Remove some unused dependencies

* Remove some stale/unused "files" entries from package.json files

* Remove unnecessary placeholder test scripts to keep some noise out
  of `rush test`
2021-04-13 12:17:03 -07:00
Nick Guerrera ca79ff5e51 Merge pull request #441 from nguerrera/tuple-syntax-highlighting
Handle tuple expressions in syntax highlighting
2021-04-10 11:01:00 -07:00
Nick Guerrera a14b5f62cc Use more accurate key name for identifier expressions 2021-04-10 09:57:48 -07:00
Nick Guerrera 55f3910f73 Handle tuple expressions in syntax highlighting 2021-04-10 09:46:36 -07:00
Nick Guerrera dcc9fb1659 Stamp VS vsix and assembly with version from package.json 2021-04-09 17:51:29 -07:00
Nick Guerrera 0f2a5e9c48 Move VS vsix to root of npm package
Hide ugly bin/Release implementation detail
2021-04-09 17:36:06 -07:00
Nick Guerrera 33cf9b6dca Log output from ADL language server to VS output window pane (#437)
* Log output from ADL language server to VS output window pane
* Use nullable
* Turn up warnings; treat warnings as errors
* Launch petstore sample on F5 to reduce iteration time
2021-04-08 16:52:26 -07:00
Nick Guerrera 24c7bd92a6 Improve watching of tmlanguage and spec (#435)
* Fix null ref bug that broke spec generation
* Move processing in-proc to speed things up further
* Reduce polling interval to 200 ms
* Log diagnostics with appropriate source file
* Make output prettier
* Fix some breakage in launch.json after some things moved around
2021-04-08 16:48:26 -07:00
Nick Guerrera abdb700b16 Speed up watching by using fewer process hops 2021-04-06 15:35:00 -07:00
Nick Guerrera 009d15928a Inline grammar into spec source to fix link issue 2021-04-06 13:44:54 -07:00
Nick Guerrera 0d9e383315 Start language specification (#426)
* Initial commit of generated docs/spec.html with just grammar for now
* Add spec generation on source change to VS Code watch tasks
* Move tmlanguage generation from pre-lauch to watch task
* Cleanup .gitattributes
 * Automatic text/binary distinction
 * Get GitHub to collapse generated files by default
2021-04-06 12:06:43 -07:00
Brian Terlson 9d9302d9c1 Update ADL to 0.8.0 (#429) 2021-04-05 18:31:06 -07:00
Brian Terlson 3822a9daf8 new package names :( (#427) 2021-04-05 17:54:09 -07:00
Brian Terlson 4065f11f5d Remove parenless decorators (#425) 2021-04-05 16:01:20 -07:00
Brian Terlson 6079cf299f Add libraries using npm, create @adl/rpaas, @adl/rest, @adl/openapi (#422) 2021-04-05 13:18:00 -07:00
David Wilson 69dc7f8c4f Add --option parameter for passing arbitrary ADL options 2021-04-05 11:02:12 -07:00
David Wilson b1da0b2392 Add `strictCommands` to CLI configuration 2021-04-05 10:32:09 -07:00
David Wilson 8216572ff8 Add `--arm-types-path` parameter for specifying ARM types.json path 2021-04-05 10:19:03 -07:00
David Wilson 8551f4cea2 Add common ARM parameter definitions for resource operations 2021-04-05 10:19:03 -07:00
Nick Guerrera d24d5cab91 Simplify prettier setup (#418)
Use a global command that checks the whole repo to avoid having to repeat the
complex commands in each project, and to prevent some files from escaping the
check.

NOTE: This removes per-project `npm run format` and `npm run check-format`.
Use `rush format` and `rush check-format`.
2021-04-02 15:01:06 -07:00
Nick Guerrera 310942c07d Don't rebuild on pack/publish (#417) 2021-04-02 14:49:28 -07:00
Nick Guerrera 8568e3c2dc Merge pull request #414 from nguerrera/vs-dev-server
* Move source files out of roots and tidy tsconfig
* Use local build of adl-server when debugging VS extension
2021-04-02 13:49:41 -07:00
Nick Guerrera 9db0568a45 Use local build of adl-server when debugging VS extension 2021-04-02 13:41:40 -07:00
Nick Guerrera 7b0b01ac99 Move source files out of roots and tidy tsconfig 2021-04-01 16:44:38 -07:00
David Wilson 2baf28ce84 Merge pull request #410 from daviwil/openapi-security
Add default ARM security details in emitted OpenAPI specs
2021-04-01 15:38:49 -07:00
David Wilson e9fd428328 Standardize service namespace management and handling 2021-04-01 14:30:51 -07:00
Nick Guerrera a7017bb5d5 Add commands to install and uninstall VS classic extension (#412) 2021-04-01 12:28:50 -07:00
Nick Guerrera b37b35a25c Don't deploy VS extension on release builds (#411) 2021-03-31 18:02:07 -07:00
Nick Guerrera 3be20331b5 Bump versions 2021-03-31 15:05:01 -07:00
Nick Guerrera 9e082a5470 Add adl-vs to build and PR validation (#407) 2021-03-31 14:50:42 -07:00
Nick Guerrera 09f7078699 Initial implementation of Visual Studio (classic) extension 2021-03-30 12:45:58 -07:00
Nick Guerrera 48f2db5440 Switch to plist format for textmate grammar 2021-03-30 12:45:58 -07:00
Nick Guerrera a710be4a43 Build script cleanup (#399)
* Fix `rush dogfood` without prior build
* Fix not being able to run other commands while `rush watch` is running
* Switch all build scripts to esm
* Reuse "run" helper throughout for spawning processes with logging + error handling
* Remove `rush compile` and `rush pack`, not really needed
* Remove `rush clean`, didn't do anything as our projects don't have clean scripts
* Clean up `rush --help` to show which commands are custom with better descriptions
2021-03-30 12:39:09 -07:00
Nick Guerrera b0938f4978 Add import and using to syntax highlighting (#403)
Also fix bug with type parameters/arguments stopping coloring after
first parameter or argument.
2021-03-30 12:26:12 -07:00
Brian Terlson 3d5410354f Implement import statements (#397) 2021-03-29 18:00:11 -07:00
David Wilson 5f8b5c3ca9 Merge pull request #388 from daviwil/service-metadata 2021-03-29 16:01:45 -07:00
David Wilson dfd77d4898 Fix formatting issues 2021-03-29 15:56:04 -07:00
David Wilson 6960087190 Strip namespace in OpenAPI definitions when there are no conflicts 2021-03-29 15:56:04 -07:00
Nick Guerrera 0a344db306 Add configuration option for adl-server path (#395) 2021-03-29 13:51:26 -07:00
David Wilson 40e6004409 Generate ARM TrackedResource namespace inside of parent namespace 2021-03-26 17:06:38 -07:00
Brian Terlson 230c66b357 Fix referencing symbols found in parent ns of top blockless ns 2021-03-26 17:05:48 -07:00
Brian Terlson a2a5a91a1f fix immediate bug 2021-03-26 17:05:28 -07:00
Brian Terlson 6c2c434c31 add some ns test validations 2021-03-26 17:04:58 -07:00
David Wilson eaabbcba45 Propagate namespace scope in binder 2021-03-26 14:24:58 -07:00
David Wilson 9cd6611872 Add `@produces` and `@consumes` for global produces/consumes types 2021-03-26 13:42:16 -07:00
David Wilson fa5cde5972 Add `@serviceTitle` and `@serviceVersion` top-level service metadata 2021-03-26 13:42:16 -07:00
Brian Terlson 72afcd17ba Add using statement (#391) 2021-03-26 12:40:14 -07:00
Nick Guerrera 15906bfa8d Prepare publish 2021-03-26 10:07:53 -07:00
Nick Guerrera 3f91bdda96 Fix hard-coding of adl and wasm file resolution 2021-03-26 10:06:18 -07:00
Brian Terlson 1fcc7dd630 Fix id lookup with blockless namespaces (#389) 2021-03-26 09:41:02 -07:00
David Wilson cf8657b155 Add `@numeric` decorator for marking numeric intrinsic types 2021-03-25 14:49:55 -07:00
David Wilson 4efa892716 Change the Unix permissions of cmd launcher files 2021-03-25 14:38:38 -07:00
David Wilson 6cf505ac71 Add `@minValue` and `@maxValue` decorators for numeric types 2021-03-25 14:38:38 -07:00
David Wilson 1ca2a4a549 Enable the use of recursive type references in model definitions 2021-03-25 09:16:12 -07:00
Brian Terlson dc240c6c82 Namespace merging, dotted namespaces, blockless namespaces, tests (#375)
Also adds a noEmit compiler option.
2021-03-24 19:20:20 -07:00
Nick Guerrera b6bbffb873 Include language-configuration.json in vsix (#383)
This was preventing commenting and indenting operations in VS Code from
working as expected when run from VSIX (as opposed to F5) since the file
was not actually put in the package.
2021-03-24 14:32:22 -07:00
Nick Guerrera d431e83fbf A bit more s/textmate/tmlanguage-generator/ (#382) 2021-03-24 14:31:01 -07:00
Nick Guerrera 672cb699fa Extract textmate generator to helper library (#380) 2021-03-24 13:20:54 -07:00
David Wilson 7034d33f78 Merge pull request #374 from daviwil/add-read-only 2021-03-23 15:02:23 -07:00
David Wilson c9185722f0 `visibility` decorator takes multiple values, emit `x-ms-mutability` 2021-03-23 14:03:46 -07:00
Nick Guerrera b4be0340a9 Fix rollup warning filter typo
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
2021-03-23 10:05:42 -07:00
Nick Guerrera 76a95d7b84 Add dogfood command 2021-03-22 21:31:01 -07:00
Nick Guerrera 3286cd2e33 Bump versions 2021-03-22 21:28:18 -07:00
Nick Guerrera 0927bbd0c7 Add commands to install/uninstall VS Code extension 2021-03-22 21:18:19 -07:00
Nick Guerrera 01cd73067a Slight CLI refactor to make it easier to add another command 2021-03-22 17:53:11 -07:00
Nick Guerrera a1ab73d794 Remove unecessary array from rollup config 2021-03-22 17:53:11 -07:00
Nick Guerrera 1e9e8255f1 Move vscode-languageclient to dev dependency 2021-03-22 17:53:11 -07:00
David Wilson 872993ffcc Rename all date and time intrinsics to follow new JS naming pattern 2021-03-22 13:53:26 -07:00
David Wilson dcb93e9ce9 Add `time` intrinsic type 2021-03-22 13:11:05 -07:00
Nick Guerrera fe6bc05b7d Generate ThirdPartyNotices.txt 2021-03-18 08:51:36 -07:00
Nick Guerrera e80311d9af Move language server out of extension and bundle the rest 2021-03-18 08:51:36 -07:00
Nick Guerrera 794c8f3b06 Remove circular dependency + other minor rollup compat 2021-03-17 09:46:48 -07:00
Nick Guerrera 79595a1f58 Add LICENSE to adl-vscode 2021-03-17 09:46:48 -07:00
Nick Guerrera a180a0ff44 Bump versions 2021-03-17 09:46:48 -07:00
Nick Guerrera e43a5495fc Fix VSIX packaging and add PR validation 2021-03-11 16:37:56 -08:00
Nick Guerrera a424d2d68b Work around rush bug 2021-03-11 16:37:56 -08:00
Nick Guerrera 49385ddfb5 Introduce language server and add live parse errors to VS Code 2021-03-11 16:37:51 -08:00
Nick Guerrera 0975c022fc Use wasm version of oniguruma (#366) 2021-03-11 14:28:42 -08:00
David Wilson 25fa27a36e Prepare @azure-tools/adl 0.3.0 for publishing 2021-03-11 11:15:12 -08:00
Nick Guerrera d6b42466eb Fix off-by-one error preventing empty string literals (#361) 2021-03-09 15:01:01 -08:00
Nick Guerrera 50954d6b80 Fix typo in format scripts 2021-03-05 12:55:30 -08:00
Nick Guerrera 3fd267eed1 Keep diagnostic data structured in DiagnosticError (#358) 2021-03-05 12:05:24 -08:00
Nick Guerrera 346670ab43 Track extension version with rush change (#322) 2021-03-05 12:04:55 -08:00
Nick Guerrera b5ae16c98c Run prettier and check formatting on more files (#348) 2021-03-05 12:01:35 -08:00
Brian Terlson f9a2d3ce7b move some throwDiag to regular exceptions 2021-03-04 15:36:51 -08:00
Brian Terlson e993c2355c format 2021-03-04 13:50:24 -08:00
Brian Terlson 3773cb1c04 Fix type name generation 2021-03-04 13:44:04 -08:00
Brian Terlson ca96f9cf3b It's ok to run decorators on non-templated models 2021-03-04 12:29:24 -08:00
Brian Terlson 47866d53d8 Finish namespace implementation, fix circularity 2021-03-04 11:57:26 -08:00
David Wilson 55ac2208f5 Implement nested namespace parsing, rename some core types 2021-03-04 10:05:37 -08:00
Brian Terlson d617fe3000 Remove ast-node type caching, fix bugs, refactor. 2021-03-03 17:12:30 -08:00
James Casey 865bca432f Add tag decorator
This applies to both namespaces and operations.  The tags for a
operation is the union of the oeration and namespace tags.

Empty tags sections are added to an operation if no tags are specified.

Sample usage:
```
@tag("foo")
@tag("bar")
namespace test {
  @tag("my_ops")
  op create(@path id:int32): null;
}
```
2021-03-02 14:03:50 -08:00
Nick Guerrera 3ddff8ef08 Make sure to build before packaging (#318) 2021-03-01 14:16:59 -08:00
Nick Guerrera d0dbe22e0c Introduce vscode extension with syntax highlighting (#314) 2021-03-01 13:35:48 -08:00
Nick Guerrera dbe9ffd544 Prettier (#316)
* Setup prettier with config borrowed from azure-sdk-for-js
* Run prettier to format existing code
* Turn format on save on so VS Code with prettier will auto-format
* Add rush check-format / rush format to check formatting / run prettier on whole repo
* Add check-format to PR validation
2021-03-01 12:55:14 -08:00
Brian Terlson 9094a8a7c8 Add nostdlib (#317) 2021-03-01 12:33:35 -08:00
Brian Terlson 4c67999669 Fix class extends t (#315) 2021-03-01 11:37:36 -08:00
Nick Guerrera 02141ec9ba Improve programmer productivity with diagnostics (#301)
1. Make throwDiagnostic take the target directly and figure out the
   location rather than having the programmer call getSourceLocation.

2. If getting location or formatting message fails, include as much of
   the diagnostic as possible in the internal compiler error.
2021-02-16 10:41:51 -08:00
Nick Guerrera ba844ea8e5 Log source location with all errors (#295)
Everywhere we throw an error now reports a location. Use
throwDiagnostic plus getSourceLocationOfXxx helpers going forward
for new errors. (We still need to do error recovery and not just
throw at the first sign of trouble, but that isn't part of this
initial pass.)

Fix duplicate name reporting in binder to report duplicates in
the same file as an error and to report locations of all
duplicates up to the first bound source file that introduced at
least one.

Fix issue where failed compilation was saying "Compilation
completed successfully" and ensure process exits with non-zero
code on failure.
2021-02-12 15:33:02 -08:00
Brian Terlson 08cc454619 Fix language.md conflicT 2021-02-12 14:34:39 -08:00
Brian Terlson 4709e4db1f move visibility decorators into lib 2021-02-12 14:32:32 -08:00
Brian Terlson 6fd5cb1757 Add better error message 2021-02-12 14:32:31 -08:00
Brian Terlson 632ff0840e move to explicit body for Ok<T>, support explicit body in openapi emitter 2021-02-12 14:32:31 -08:00
Brian Terlson 04129fd15a cleanup 2021-02-12 14:32:31 -08:00
Brian Terlson abce858641 cleanup 2021-02-12 14:32:31 -08:00
Brian Terlson fcbb7603ef Implement #276 composition reform 2021-02-12 14:32:27 -08:00
Nick Guerrera 2a7e9394d5 Update to grammarkdown 3.1.2 (#296)
Fixes issue with git warnings about CRLF
2021-02-12 14:01:34 -08:00
Nick Guerrera a0ea765fbf Add optional properties and missing punctuation to grammar (#289) 2021-02-10 11:26:10 -08:00
Nick Guerrera a8b5456762 Remove some casts (#283) 2021-02-10 11:24:53 -08:00
David Wilson 38f915eb87 Merge pull request #288 from daviwil/testserver-media-types
Add converted autorest.testserver media-types spec
2021-02-10 09:36:58 -08:00
David Wilson 289c504a82 Enable minLength and maxLength to be applied to model properties 2021-02-09 16:16:28 -08:00
Nick Guerrera 1dad0e6bfb Include source file path in parse error log 2021-02-09 14:03:10 -08:00
Nick Guerrera 48f1f7c633 Turn off eslint, format on save (#284) 2021-02-09 09:42:34 -08:00
Nick Guerrera 2418aa6f8d Add back line and column tracking (#282) 2021-02-08 15:48:53 -08:00
David Wilson ab08676c37 Fix namespace examples in unit tests 2021-02-08 11:49:56 -08:00
David Wilson 4f704c9cc3 Add `op` keyword for namespace properties 2021-02-08 11:45:07 -08:00
David Wilson f056c012e4 Update grammar file to reflect interface -> namespace 2021-02-08 11:44:07 -08:00
David Wilson 73ddb6858b Change 'interface' keyword to 'namespace' 2021-02-08 11:44:05 -08:00
Nick Guerrera 3198caebe3 Refactor scanner to use less state (#281)
The scanner was doing a lot of work per character. While this may have
been a performance problem, the motivation here is maintainability. This
change makes it so that advancing by one character is simply Scanner.position++.
It also does more work lazily: allocating substrings on demand.

Highlights:

* Remove unused tokens
* Rename Kind to Token
* Remove token position map
* Remove character size bookkeeping
* Remove (ch, chNext, chNext) state
* Convert class to closure

Note: Line and column tracking was temporarily removed to facilitate
refactoring and will be re-added in the following change.
2021-02-08 11:38:10 -08:00
David Wilson c534f63795 Rename types with -Response suffix, add Location header model 2021-02-08 10:03:31 -08:00
David Wilson 7f8175a335 Templatize Created response 2021-02-04 16:25:00 -08:00
David Wilson b27d974e66 Add some more standard HTTP response models 2021-02-04 16:19:36 -08:00
David Wilson ad374b2ae5 Remove @doc string for Ok<T> 2021-02-04 16:12:01 -08:00
David Wilson 485c63c9e0 Add a standard Ok<T> type to rest.adl 2021-02-04 16:05:59 -08:00
David Wilson 3e5ff9af98 Add intrinsic null type, null unions, and emit x-nullable in OpenAPI 2021-02-04 15:16:17 -08:00
David Wilson 419ca7cb41 Add script and PR step to check sample output for regressions 2021-02-04 15:12:55 -08:00
David Wilson baab8f3d38 Merge pull request #273 from daviwil/parameterize-language
Add --language parameter for generate command
2021-02-02 15:56:15 -08:00
David Wilson 2f9ba63276 Remove hardcoded @autorest/core version (for now) 2021-02-02 11:02:54 -08:00
Nick Guerrera 0d626a9f6d Support arrays of arrays and parenthesized expressions (#272)
Also:
* Document template parameters in grammar
* Document empty statement in grammar
* Tighten MemberExpression (conservatively for now) to just apply to identifiers
* Use OrHigher convention in grammar and parser
2021-02-01 15:47:24 -08:00
David Wilson 3f53fd611e Update AutoRest version 2021-02-01 15:14:29 -08:00
David Wilson e01bd7b9be Add --language parameter for generate command 2021-02-01 15:14:29 -08:00
David Wilson bd988b2176 Merge pull request #269 from daviwil/add-primitives
Add byte and datetime primitives
2021-01-28 15:28:14 -08:00
David Wilson 6eb7e6d09c Merge pull request #270 from daviwil/add-rest-subpaths
Update rest and openapi libraries to support verb decorator subpaths
2021-01-28 15:27:56 -08:00
David Wilson c2bfc505bd Improve support for float and double types 2021-01-28 15:22:48 -08:00
David Wilson d11f7ed250 Update rest and openapi libraries to support verb decorator subpaths 2021-01-28 15:12:21 -08:00
David Wilson 8b75185f3b Add byte primitive type 2021-01-28 15:05:28 -08:00
David Wilson 992e18becb Add datetime primitive type 2021-01-28 14:22:21 -08:00
David Wilson 85a911b470 Prepare packages and changelogs for release 2021-01-28 13:30:15 -08:00
David Wilson 79ff089c32 Fix path resolution when loading decorator modules 2021-01-28 11:10:12 -08:00
David Wilson 6343970170 Bump ADL to 0.2.0 and establish changelog 2021-01-27 13:49:45 -08:00
David Wilson 6f3b1430cb Constrain the set of files included in npm releases 2021-01-25 14:40:29 -08:00
Nick Guerrera 6bbeb6949b Merge pull request #256 from nguerrera/grammar-cleanup
Remove some redundant language constructs
2021-01-25 14:13:23 -08:00
David Wilson 339269cb6a Require Node 14 for ECMAScript module support 2021-01-25 13:24:08 -08:00
Nick Guerrera a252cadc18 Remove square bracket alternate decorator syntax 2021-01-25 12:11:06 -08:00
Nick Guerrera a9e636432a Standardize on only double quotes for string literals 2021-01-25 12:05:32 -08:00
Nick Guerrera 74391e4540 Clean up numeric literal handling in scanner
* Document binary literals in grammar
* Remove tolerance of uppercase 0B, 0X, and E for exponent
* Remove tolerance of leading decimal point
2021-01-25 11:37:54 -08:00
Nick Guerrera 354592fbb2 Remove `alias` statement, prefer `model =` 2021-01-25 10:46:34 -08:00
David Wilson 7fafee3978 Pass through AutoRest exit code on code generation error 2021-01-22 16:38:07 -08:00
David Wilson ce89aa8880 Improve basic CLI output, add --version parameter 2021-01-22 16:26:19 -08:00
David Wilson dfdd101202 Move cli.ts to compiler/ to keep it out of stdlib folder 2021-01-22 16:26:19 -08:00
David Wilson f97bbffe71 Prepare @azure-tools/adl release automation and add README 2021-01-22 16:26:17 -08:00
David Wilson (AZURE SDK) ba9e579b11 Improve resolve of AutoRest dependency path 2021-01-22 16:25:43 -08:00
Nick Guerrera cd6d3c2015 Update grammar to reflect current state, use grammarkdown (#245)
Update language grammar to reflect current state of the language.

Grammarkdown is now used and run during the build. It will error
out if the grammar is invalid in ways such as a reference to
something that isn't defined.

Other minor changes:
* Fix up some VS Code build and launch settings
* Remove stale references to VS Code extension projections
2021-01-22 14:30:26 -08:00
David Wilson (AZURE SDK) 524e124c66 Add more generic @list decorator for pageable operations 2021-01-22 14:05:25 -08:00
David Wilson (AZURE SDK) 7b193321cf Install AutoRest as dependency and launch it from node_modules 2021-01-22 11:59:49 -08:00
David Wilson (AZURE SDK) 7a71fdc46f Launch AutoRest correctly on Windows 2021-01-22 11:54:27 -08:00
David Wilson (AZURE SDK) e5118270f2 Remove VisbilityLevels type union 2021-01-22 11:48:50 -08:00
David Wilson c4979e7d27 Add @visibility decorator 2021-01-21 07:14:18 -08:00
David Wilson dad53a5c05 Fix minor issues in CLI interface 2021-01-21 07:14:18 -08:00
David Wilson b04acc8a08 Add @secret decorator, minor cleanup 2021-01-21 06:42:46 -08:00
David Wilson 397e30c4bc Add 'generate' command for generating a client SDK from ADL 2021-01-20 16:28:57 -08:00
David Wilson 0431bd90d7 Add evalAdlScript API for full evaluation of virtual script files 2021-01-20 15:07:48 -08:00
David Wilson 8dc9aa22be Write out exception stack trace when --debug is passed 2021-01-20 14:25:31 -08:00
David Wilson 1e98dce0f9 Add ARM decorator library and ADL types 2021-01-20 11:26:48 -08:00
David Wilson c6a11b6f7c Correctly handle compile() as a promise 2021-01-14 16:17:55 -08:00
David Wilson 6e06caacd2 Enable @format, @minLength, @maxLength decorators; fix OpenAPI types 2021-01-14 16:17:10 -08:00
David Wilson 3035ec06fb Store the assignmentType when creating a ModelType from assignment 2021-01-14 16:13:21 -08:00
David Wilson 121f600f6e Add bug number for _delete issue 2021-01-14 09:17:06 -08:00
David Wilson 9da578a5d5 Add decorators for HTTP verbs (get, put, post, patch, delete) 2021-01-13 15:42:43 -08:00
David Wilson a179c95e13 Add basic ADL command line interface 2021-01-11 17:09:09 -08:00
David Wilson 7750bc98b7 Rename 'packages/language' to 'packages/adl' 2021-01-05 16:39:35 -08:00
David Wilson 23b5778230 Rename 'adl' folder to 'packages' 2021-01-05 16:39:00 -08:00