Commit Graph

26 Commits

Author SHA1 Message Date
Dirk Bäumer
13a88a8da4
Fixes #208581: ESLint and .vscode/extensions is tricky to configure (#210031) 2024-04-10 12:03:56 +02:00
Matt Bierner
45e2e0bfd0
JS/TS package acquisition (#184438)
* Experiment with adding ata using `@types` packages shipped in an extension

* Use own file system instead of `https`

* JS/TS type support on web

* Tsconfig needs esModuleInterop not module:nodenext

We actually want webpack to emit commonjs, but need to write ES default
imports to use node-maintainer

* fix package.json indentation

* Adding setting to disable web type acquisition

* Fix merge of yarn lock

* Fixing merge errors

* Fixing errors

* Pick up package externally

* Fixing conflicts

* Bump version

---------

Co-authored-by: Kat Marchán <kzm@zkat.tech>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2023-08-28 00:49:40 -07:00
Nathan Shively-Sanders
3261c7d3af
Cross-file Typescript support in vscode-web (#169311)
* recreate logging from other machine

* comment out openSystemBrowser

Because I dont have the default browser set up correctnly on any of my
machiens

* Add vscode-wasm-typescript dep

And some logging as I figure out how to use it

* remove unused reference to module

* use require reference that linter allows

* Add vscode-wasm-typescript to tsserver.web.js

Use webpack's CopyPlugin transform pattern to do this manually. This is
probably a bad idea! It's just for prototyping purposes.

* Update vscode-wasm-typescript dependency

* Fix minor syntax in webpack hack

Nonetheless required for it to work!

* Fix another typo in webpack hack!

* Fix provided typescript path

Another typo. Guess my local test wasn't running the contents really

* Try to improve module.exports handling in webpack hac

* tsserver.web.js comes from local builds

Also:
- tsserver.js is no longer minified
- log crossOriginIsolated

* First attempt to set up server-side support

* Remove auto-imported identifier

* Move sync-api setup code to serverProcess.browser.ts

Because it's browser-specific

* Reorder webpack hack and clean up unused logging

* Update vscode-wasm/vscode-wasm-typescript dependencies

* Add file watching

* Extract webpack hack

Build only the ts parts of tsserver.web.js, don't rebuild the vscode
extension. This is a lot faster.

* Remove manual verbose logging

Sheetal showed me the correct way to create a verbose logger instead.

* Add vscode-test-web to semantic-supported schemes

And make isWeb support semantic mode.

* Also update the webpack-hack-only build

* Switch to tsserverlibrary

Also paste in some example code for cancellation, which is not finished
at all.

* Remove bogus auto-import and unneeded (?) dep

* remove webpack-like hack

* move code from vscode-wasm-typescript

* Initial prototype of cancellation

It compiles and looks kind of plausible. But I haven't tested it yet.

* Switch tsserver to separate MessageChannel

* Move watches to a separate MessagePort

Further simplifies the message dispatch code by shifting complexity to
setup. And the setup is straight-line code.

* switch vscode-web from in-memory to real filesystem

goto-def is currently broken because some part of main vscode still
needs treat the files as in-memory, though.

* Make toResource translate / -> vscode-test-web

* Encode scheme and authority in TS filenames

Like the previous host did, but without the leading ^ that TS hard-codes
as "in-memory".

The tsserver host needs to know about the encoding, but the translation
is in a single function. This also means that displayed file paths are
prefixed with /scheme/authority (/vscode-test-web/mount in my testing), but I think that's fine.

* Lift parseUri outside createServerHost

I'm not using it to set the schema/authority for getCurrentDirectory
right now, so there's no shared state to mutate.

* Special-case URI of lib*d.ts in webServer.toResource

Similar to the special-casing in typescriptServiceClient.toResource.
Also requires passing in the extensionUri. This feels like it's breaking
through at least one abstraction layer, which might be a problem.

* Improve cancellation

1. Simplify cancellation checking in web tsserver host to match the
checking in typescript's node host.
2. Move cancellation of request in the extension to tryCancelRequest
from sendNextRequests.
3. Only send cancellation via node or web cancellation, not both.

* Pass in current request instead of waiting for a fresh one.

* Address initial PR comments

Also add some TODO comments for the revision to watches.

* Add cancellation bit to each (cancellable) request, locally fix an issue with retrieving the cancellation bit

* Switch to per-file/directory watches

Watching the entire filesystem recursively is supposed to be
inefficient.

Not done yet: there is an error when watching directories, but it works.
And I can't tell whether watching files works yet.

* Parse --serverMode partialSemantic in webServer

Now the syntax server actually runs as a syntax server.

* Simplify logging code

* Cleanup in webServer

1. Remove a little logging.
2. Correct failure return value for getFileSize
3. Reorder some methods and parameters.

* Switch to markdown extension's FileWatcherManager

I'm not sure if it's OK to depend on a module from another extension;
it's probably better to include the files from a central place instead.

* Clean up host methods

1. Copy and adapt implementations from node host where possible.
2. Note questions for the PR elsewhere.
3. Remove logging except for caught exceptions.

* More logging/TODO cleanup

* Remove duplicate dependency

* Add setting to enable/disable semantic mode on web

Also gate it behind a check to `crossOriginIsolated`

* Re-order and re-arrange code to minimise PR diff

It won't minimise it *much*, but I also consolidated some
unnecessarily-spread-out code that will be easier to read in the long
term, and possibly easier to read in diff form as well.

* Copy fileWatchingManager to typescript extension

Copy from markdown extension to typescript extension. I used the
existing dependencies in the typescript extension, but verified that
they would work the same.

* Fix linting of webServer

* Align formatting of catch / else

* Extract isProjectWideIntellisenseOnWebEnabled and keep using in-memory prefix when project wide intellisense is disabled

* Make sure we still work if SharedArrayBuffers aren't supported

* Remove symlink support and fix typo

Symlinks are implicitly supported by the filesystem right now.

* Fix compile errors

Co-authored-by: Johannes <johannes.rieken@gmail.com>
Co-authored-by: Matt Bierner <matb@microsoft.com>
2023-01-12 11:54:39 -08:00
Matt Bierner
ebeccc9e05
Ignore webserver for eslint (#166338)
Ignore webserver from eslint
2022-11-14 21:22:03 -08:00
Matt Bierner
44441de137
Adopt prefer-readonly in JS/TS extension (#165089) 2022-11-14 20:12:10 -08:00
Matt Bierner
a4c9ea968d
Pick up latest versions of eslint (#162896) 2022-10-06 15:37:27 -07:00
Alexandru Dima
9db5a3674e
Bring the nls loader plugin into our sources (#152338) 2022-06-16 22:01:19 +02:00
Alexandru Dima
d132489cd0
Bring the css loader plugin into our sources (#152205) 2022-06-15 16:53:02 +02:00
Johannes
0f648cd7db
add eslint rule to disallow look behind regex feature, ignore in git and markdown fyi @lszomoru, @mjbvz 2022-03-22 16:02:19 +01:00
Alex Dima
cab9713422
Fixes #141994: Address eslint problems 2022-02-02 13:18:12 +01:00
Johannes Rieken
7ccb868835
make sure to use .eslintignore when running yarn eslint, this will ensure that cli failure and editor squiggles are always equal 2022-02-02 12:37:29 +01:00
Benjamin Pasero
13461f8c61
Web: change yarn web to run with our server instead of playground (#139725)
* web - first cut `yarn web` via our server

* properly pipe output

* web - remove traces of web playground

* web - remember last opened workspace for convinience

* use vscode-test-web for server less, clean up web commands

* fix comment

* fix `yarn web`

* rename to code-server

* open system browser

* code-server script: use minimist

* test resolver: use ./scripts/code-server

* integartion tests: fix code-server command name

Co-authored-by: Martin Aeschlimann <martinae@microsoft.com>
2022-01-20 13:48:08 +01:00
Matt Bierner
474d4951d8
Switch to dompurify for sanitizing markdown content (#131950)
* Switch to dompurify for sanitizing markdown content

Switches us from using `insane` to instead use `dompurify`, which seems to be better maintained and also has some nice features, such as built-in trusted types support

I've tried to port over our existing sanitizer settings as best as possible, but there's not always a 1:1 mapping between how insane works and how dompurify does. I'd like to get this change in early in the iteration to catch potential regressions

* Remove logging and renaming param

* Move dompurify to browser layer

* Fixing tests and how we check valid attributes

* Allow innerhtml in specific files

* Use isEqualNode instead of checking innerHTML directly

innerHTML can return different results on different browsers. Use `isEqualNode` instead

* Reapply fix for trusted types

* Enable ALLOW_UNKNOWN_PROTOCOLS

I beleive this is required since we allow links to commands and loading images over remote

* in -> of

* Fix check of protocol

* Enable two more safe tags
2021-09-03 12:17:02 -07:00
HaoLiHaiO
4387dea116 fix typo 2021-08-27 19:52:57 +03:00
Henning Dieterichs
4f0939431c
Adds files to .eslintignore that are not linted by "yarn eslint" to ensure no CI errors => no editor errors. 2021-07-21 09:30:04 +02:00
Henning Dieterichs
2a0c4cc1c3
Uses eslint-plugin-header to enforce license headers. Features quick fix to add license header. 2021-07-09 18:20:17 +02:00
Matt Bierner
35f855796b
Add support for markdown notebook renderers (#115191)
* Use shared webpack version instead of installing locally for simple-browser

* Use npm for building markdown preview

* render markdown in webview.

* update markdown preview height and offset

* Add basic custom notebook renderer point

* update css

* style update.

* update markdown header padding left

* Add example of loading katex to extend the markdown-it renderer

* Rename global to make clear it only applies to markdown-in

* hide/remove markdown preview

* Add wait for initial markdown preview rendering before showing notebook

* Add double click to switch to editing mode

* Fix markdown cells not getting updated after editing

* style polish

* notebook.experimental.useMarkdownRenderer

* switch render strategy.

* Adding very intial drag drop support for notebook markdown cells

* Implement drag/drop stubs for test classes

* Revert unrelated file changes

* Move markdown notebook math to own extension

* Add missing imports

Co-authored-by: rebornix <penn.lv@gmail.com>
2021-02-10 16:41:53 -08:00
Matt Bierner
04ec120e2c Exclude dist from eslint and hygine
These files come from the web builds
2020-12-09 18:45:54 -08:00
Matt Bierner
71fad5aa41 Enable preferConst in TS project 2020-12-09 18:19:14 -08:00
Sandeep Somavarapu
88144f6d31 Fix #80698
- Inline semver
2020-10-26 12:12:07 +01:00
Johannes Rieken
02f23e5680 remove polyfill promise 2020-03-02 15:30:43 +01:00
Johannes Rieken
2bd15957aa tweak ignore file 2019-12-31 10:39:33 +01:00
Johannes Rieken
54d20309fa tweak rules and excludes 2019-12-30 10:51:58 +01:00
Johannes Rieken
a1047421ff use single eslintrc-file for extensions/ and src/, no type check rules 2019-12-24 16:11:51 +01:00
Johannes Rieken
31d049f329 use (most of) generated eslintrc-file 2019-12-24 13:51:11 +01:00
Johannes Rieken
556475c71f add eslint-rules "module" and use it in eslintrc-file 2019-12-24 13:07:59 +01:00