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

40 Коммитов

Автор SHA1 Сообщение Дата
Timothee Guerin 842405e8d1
Get rid of rush and move to pnpm (#2775)
Remove the opinionated (wrongly so most of the time) middleman that
brings more config pain than value.

Things to check:
- [x] Parallel build performance vs rush
- [ ] Publishing with submodule
- [x] Changesets
2024-01-24 13:37:34 -08:00
Timothee Guerin 55ea44250d
Vitest improvements: vitest-ui, watch mode for deps, debug config (#2791)
Add vitest ui package and `test:ui` command to popup the vitest UI
https://vitest.dev/guide/ui

Import the common vitest config from the workspace so each package
doesn't need to define all of it.
Added `watchExclude: []` to the common config to preven vitest from
excluding dist and node_modules folder which is required so it can auto
rerun the test on when a dependency (monorepo dep) rebuilds

Added debug config to debug the current test. As the vitest extensions
is quite unreliable this should help
2024-01-22 09:56:55 -08:00
Timothee Guerin 55e232d553
Add a new init template to setup a library (#2766)
Add a new library template with:
- `@alernateName` decorator with some custom diagnostics and tests for
it.
- a linter rule and 2 rulesets(`recommended` and `all`)
2024-01-04 12:22:21 -08:00
Timothee Guerin 9c7bf80187
Migrate test framework to vitest (#2769)
Get rid of mocha and upgrade to vitest which is a more modern
alternative providing, watch, direct typescript compilation out of the
box, expect library and more.

Advantage over mocha:
- Much better cli
  -  watch mode
  - better diff
- Better extension:
  -  tree organization for files too (not everything flattened)
- update in real time the test(no more need to refresh manually to
discover where are the tests)
  - just a little buggy
- Compiles typescript directly
- provides more expectation apis(like jest)

Cons over mocha: 
- Slower(about 2x) but that means we don't need to build the test as
part of build which would speed up that part(not as much as is lost)

Todo: 
- typespec-azure migration
2024-01-02 11:40:29 -08:00
Timothee Guerin b8dc20f989
Playground directly into the website (#2638)
Stop using an iframe and load the latest version(not next)
2023-11-08 14:25:21 -08:00
Timothee Guerin 99d80f82da
Fix playground usage from external package (#2540)
Playground usage was completely broken when used as a package. Local
reference seems to make it work but hwne the package is in node_modules
vite doesn't allow certain things
2023-10-05 12:59:06 -07:00
Timothee Guerin 0c4a80899d
Cleanup vscode settings (#2541)
We didn't have format on save for react files, use that as an oportunity
to cleanup the config a bit
2023-10-04 21:57:56 +00:00
Timothee Guerin f33b0fb140
Fix: regression causing the language server to not be runnable in the browser (#2530)
fix #2529
2023-10-03 10:12:37 -07:00
Mike Harder 42aeb993fd
Upgrade dependency "trim" from 0.0.1 to 0.0.3 (#2474)
- Migrate pnpm config from rush.json to pnpm-config.json
2023-09-22 23:53:51 +00:00
Timothee Guerin 31fd5abf97
Samples as tests (#2215)
fix [#3017](https://github.com/Azure/typespec-azure/issues/3017)

Run the samples as test which allows all of them to run without crashing
on the first one, lets us run it in the test explorer.

This also make the sample regeneration much faster(typespec azure repo):
- Before `~90s`
- Now `~12s`


![image](https://github.com/microsoft/typespec/assets/1031227/a3356a90-7847-43cf-a473-4ecda0c53330)

## New `resolveCompilerOptions` utils
This also include the addition of a new util `resolveCompilerOptions`
that resolve the compiler options programtically in the same way that
the cli would have for a given entrypoint.

I can move this into a dedicated PR if people prefer.

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2023-08-04 10:19:02 -07:00
Timothee Guerin d355e5c427
Update to support prettier 3.0 (#2157)
fix #2153

This include breaking change if using the typespec formatter
programatically. Some breaking changes to prettier carry over
https://prettier.io/blog/2023/07/05/3.0.0.html
2023-08-03 17:11:54 -07:00
Travis Prescott 8648c2e9ad
Update `@typespec/migrate` to work with updated semver package (#2202)
Fix #2195.
2023-07-21 15:34:36 -07:00
Timothee Guerin 7153402e13
Move compiler source under `src/` (#2055) 2023-06-13 13:57:29 -07:00
Travis Prescott 48a14923ba
Enforce fixes for missing docs (#1860)
* Add doc errors for decorators and decorator parameters.

* Add decorator documentation rules.

* Code review feedback.

* Update logic.

* Compiler docs fixes.

* Doc updates.

* Fix protobuf issues.

* Code review feedback.

* Test that build fails...

* Add support for scalars.

* I hate EVERYTHING about you, cSpell....

* Code review feedback.
2023-04-28 09:32:54 -07:00
Timothee Guerin 56a30c2387
Metatype accessors for select accessor (#1740) 2023-04-06 21:26:58 +00:00
Timothee Guerin 628a3a9191
Revert: Mocha test explorer parallel (#1801) 2023-04-06 21:11:14 +00:00
Nick Guerrera a9fea12e51
Parallelize test runs in IDE using mocha explorer (#1793) 2023-04-05 14:17:17 -05:00
Allen Zhang cc73b3d099
Restructuring Typespec migrate and add TypeSpec renaming, version update. (#1694)
* Adding back Cadl to all compiler public artifacts got renamed with TypeSpec

* initial restructuring

* Green compile with re-structuring mostly done.

* 0.41.0 file rename and package version update added

* TypeSpec replacement done

* tidy up the code with comments and output

* finishing up yargs

* update package.json to avoid rebase conflict

* adding test scenario

* adding cli help

* Fixing PR comments

* fixing PR checks

* tspconfig migration code working

* Update change log for migrate

* Remove eslint warning by setting no-console to false as this is a CLI tool
2023-03-10 13:56:46 -08:00
Allen Zhang 064161d827 1/3 TypeSpec: Find/Replace Content 2023-02-16 13:07:22 -08:00
Timothee Guerin c8f8752782
Feature: Cadl project file variable interpolation and `emitter-output-dir` (#1262)
* Interpolate

* Fix existing tests

* Fix regen-samples

* Add some cli tests

* Interpolate each other

* validate no relative paths

* update docs

* update docs

* ADd validation for unknown args

* :Changelog

* Fix lint

* Update packages/compiler/core/messages.ts

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>

* fix test

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2022-12-01 23:47:24 +00:00
Timothee Guerin 054cf45a49
Migrate website to use docusaurus (#1266) 2022-11-14 12:44:38 -08:00
Timothee Guerin 2e8b5fa8fb
Fix: Model is Intrinsic types apply @extension in openAPI 3 emitter (#1181) 2022-10-20 15:18:29 +00:00
Timothee Guerin 1c08f74fdd
Rename output-path to output-dir (#1145) 2022-10-11 10:25:19 -07:00
Timothee Guerin 90d84de1fb
Setup spell check and fix issues in markdown, ts and changelogs (#1000) 2022-09-09 19:54:18 +00:00
Nick Guerrera 33c2c4dc88
Make syntax tree typing deeply readonly and reuse them in language server (#868)
## Summary
* Make syntax trees deeply `readonly` in their TS typing. 
* Remove mutation of symbol tables contained in syntax trees in checker.
* Reuse syntax trees for unchanged files in language server.
* Reuse entire program when no files have changed in language server.
* Fix other miscellaneous perf issues found while profiling the impact of
  this change:
  * Avoid repeat loading of config file
  * Avoid repeat creation of schema validators
  * Avoid unnecessary parse in findDocumentHighlight.
* Add environment variables to log language server call timing and/or save
  .cpuprofile files to help with future perf work in this area.

## Performance
I'm seeing approximately 2X less time spent in language server for typing
the same sequence into petstore.cadl and navigating around with
goto-definition, document-highlight.

## Details
* We used to inject symbols into symbol tables hanging off syntax trees to
  implement using statements including the implicit `using Cadl` and member
  references. To avoid this, we now do a copy-on-write to the symbol
  tables. This adds an extra map lookup for each call to
  resolveIdentifierInTable, where we first look for a copy of the table and
  then do the actual lookup. No noticeable slowdown was observed in
  profiling based on this. It does double the time in
  resolveIdentifierInTable as 1 lookup becomes two, but this does not make a
  significant difference overall and I think it's a worthwhile trade to get
  the reuse.

* `createProgram` gains a new `oldProgram` argument from which we will reuse
  syntax trees if the host gave us identical `SourceFile` instances. We will
  also reuse the entire oldProgram and skip checking if we find that the
  compiler options and source file set are unchanged. Language server keeps
  track of last compilation for a given entry point to provide
  oldProgram. Over time, it's possible that we can reuse more of oldProgram
  in more cases.

* `CompilerHost` gains a new optional `parseCache` that allows sharing
  syntax trees between programs even if oldProgram is not supplied or the
  oldProgram didn't have a particular source file. This is particularly
  useful for language server features that do not need an entire program but
  just the syntax tree of the current document. The language server also
  uses this.

* ParseOptions (currently include comments or not) can now be specified on
  `CompilerOptions`. Language server uses this to always include comments so
  that features that need comments can share trees with features that don't.
2022-08-24 09:36:05 -05:00
Timothee Guerin 4b06c296e2
Add ability to use `workspaceFolder` in Visual studio and VSCode to interpolate settings (#891) 2022-08-19 21:23:23 +00:00
Timothee Guerin b162c3ca5b
Allow loading different install of the same library with the same version (#871) 2022-08-18 13:02:34 -07:00
Timothee Guerin 497c52e76d
Consistent file convention(kebab case and use `.test.ts` suffix for unit tests (#627) 2022-06-14 16:31:17 +00:00
Nick Guerrera 08010590e7
Disable formatOnPaste to work around prettier plugin issue (#617) 2022-06-10 15:18:38 -05:00
Nick Guerrera 192816fadc
Implement semantic coloring (#483) 2022-06-10 12:21:20 -05:00
Timothee Guerin d47e279150
Versioning with enums (#585) 2022-06-07 23:06:06 +00:00
Timothee Guerin 5394cacfb2
Provide a better diagnostic when the main file of a library is not found (#550) 2022-05-26 11:24:21 -07:00
Timothee Guerin 1ef6878f01
Configure eslint for all packages with shared config pkg (#188) 2022-02-22 15:58:17 -06:00
Nick Guerrera b1be3793e4
Allow `op` in interfaces (#270) 2022-02-17 20:55:51 +00:00
Nick Guerrera 7e0b1d4ceb
Fix scratch debug target broken by renames (#228) 2022-02-04 17:12:49 +00:00
Nick Guerrera e7d656075b
Small formatting and syntax highlighting improvements (#73)
1. Format *.cadl on save in our repo. This required some extra knobs in
.vscode/settings.json and .prettierrc.json. These are not required when
referencing the prettier plugin via npm, but we need a workaround to consume
the plugin this way from source.

2. Fix a formatter bug with operations that return anonymous models where
the braces around the return model were dropped.

3. Add cadl syntax highlighting to markdown ```cadl blocks
2021-11-22 13:04:36 -06:00
Nick Guerrera 53cbecc69c
Use prettier for markdown too (#72) 2021-11-19 15:52:17 +00:00
Timothee Guerin e3f808b899
VSCode server path use compiler path instead of bin (#43) 2021-11-05 11:10:57 -07:00
Nick Guerrera eb4e11788b
Configure cadl-server path (#39)
Resolve error about conflicting compiler versions in IDE when
working on .cadl files in the core cadl repo.
2021-11-03 18:06:38 +00:00
Nick Guerrera 2c5454dc1a Port build process to new OSS repo 2021-10-19 15:21:39 -05:00