It was defined once, but it was passed into various functions. This
added unnecessary complexity.
It is now defined in a constants file, which is imported where
necessary.
- ESLint config `remcohaszing/typechecking` is extended.
- Various previously disabled ESLint rules have now been enabled.
- Various `any` types have been fixed.
- Removed useless type check of diagnostic code.
- The diagnostics adapter listener has been turned into an actual map.
TypeScript is better at inferring types when using simple functions and
objects instead of classes. As a result many type annotations have now
been removed without impacting type safety.
Some other benefits are this can be minified better and private fields
are now truly private variables.
The YAML language service doesn’t support formatting ranges.
In practice this means the “Format Selection” option which does the same
as “Format Document” is no longer available in the menu that’s opened
when pressing F1.
This is much more flexible than `monaco-plugin-helpers`. Because of
this, it’s possible to use Prettier as an external dependency, so users
can ignore it in their own build process of they choose not to support
formatting.
Instead of rewriting YAML language service imports in the build tool, I
decided to just import them from where they need to be imported in the
source code.
Closes#63
This removes the need to explain certain statements and imports need to
happen in a specific order. Users can now just use:
```ts
import { setDiagnosticsOptions } from 'monaco-yaml';
setDiagnosticsOptions({});
```
This is a preparation for `monaco-editor@^0.22.0`. In this version the global
`monaco` object was removed for ESM users.
A choice was made to use `monaco-editor` imports, because this probably has
best compatibility for most users. If users want to use `monaco-editor-core`,
they will have to create an alias in their own build process.
Since both yaml-language-server and prettier are included in the bundle, their
versions should match for best compatibility. Also code has been formatted using
the updated prettier.
Jest, eslint, and typescript-tslint-plugin were installed, but never used. Node
types were used for timers, but this is incorrect, as this code is supposed to
run in the browser.