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

2108 Коммитов

Автор SHA1 Сообщение Дата
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