Commit Graph

45 Commits

Author SHA1 Message Date
Matt Godbolt
9e9e035b28 Rephrase frontend imports (#7824)
- Removes `rootDirs` so all imports will be relative in the frontend
- Updates (and unifies) imports to be `../types/...` etc instead of
relying on "types" being in the rootDir for the frontend.
- Fixes one type that was being picked up from `lib` in the frontend.
- Adds a precommit hook to check in future

Paves the way to writing _unit_ tests for the frontend for the subset of
the frontend code we can import from `node` (which might be a lot of
it!)
2025-06-18 09:04:23 -05:00
Matt Godbolt
25023620f3 Fix race condition in pane container closing (#7770)
## Summary

Fixes COMPILER-EXPLORER-3W3: Prevents "Can't remove child item. Unknown
content item" errors (4830 occurrences) when attempting to close
containers that have already been destroyed or removed from the layout
hierarchy.

- Uses modern TypeScript optional chaining to check container validity
before close operations
- Prevents race conditions between compiler close events and
GoldenLayout's destruction process
- Addresses issue where deferred `container.close()` calls were
executing on already-destroyed containers

## Root Cause

The error occurred when:
1. A compiler close event triggers `onCompilerClose()` which defers
`container.close()`
2. Meanwhile, GoldenLayout destroys the container through its own
process
3. The deferred close attempt executes on an already-destroyed
container, causing the GoldenLayout error

## Test plan

- [ ] Open multiple compiler panes with associated tool/output panes
- [ ] Quickly close compilers while panes are still loading/updating
- [ ] Verify no "Can't remove child item" errors appear in console
- [ ] Verify panes still close properly in normal scenarios

🤖 Generated with [Claude Code](https://claude.ai/code)
2025-06-11 16:04:31 -05:00
Mats Jun Larsen
5eea63328f Migrate to Biome for linting and formatting (#7033) 2025-02-02 17:54:31 +00:00
Ofek
caca3ea6c7 Eliminate all google-analytics dead code (#6954)
<!-- THIS COMMENT IS INVISIBLE IN THE FINAL PR, BUT FEEL FREE TO REMOVE
IT
Thanks for taking the time to improve CE. We really appreciate it.
Before opening the PR, please make sure that the tests & linter pass
their checks,
  by running `make check`.
In the best case scenario, you are also adding tests to back up your
changes,
  but don't sweat it if you don't. We can discuss them at a later date.
Feel free to append your name to the CONTRIBUTORS.md file
Thanks again, we really appreciate this!
-->
2024-10-10 21:21:43 +03:00
Ofek
12f6bfcc12 Make pane-renaming central (#6772)
When each `Pane` (and others) create their own `PaneRenaming`, which
extends `EventEmitter.EventEmitter`, when one actor emits `renamePane`
no other actor can hear it.

This PR makes `PaneRenaming` stop using its own event emission, and
instead use the central `Hub` it now receives at its ctor.
2024-08-17 22:51:11 +03:00
Ofek
9d8c503b3d Improve initialization of decorations in MonacoPane (#6426)
Make MonacoPane calls `createDecorationsCollection` in a single place
instead of forcing many subclasses to remember to call
`initDecorations`. Some subclasses never use DecorationsCollection and
call init for no reason now, but it still seems healthier - this avoids
the possibility of a MonacoPane subclass trying to use an uninitialized
decoration collection.

Also remove the depracated `deltaDecorations` from stack-usage-view.
2024-05-05 10:17:57 +03:00
Ofek
d2ee6e18a5 Replace the deprecated monaco.editor.ICodeEditor.deltaDecorations (#6078)
Replace the deprecated `monaco.editor.ICodeEditor.deltaDecorations` with `monaco.editor.IEditorDecorationsCollection`

Seems that today the official way of colouring monaco editors is having
them `createDecorationsCollection`, keep the resulting
decorations-collection and call `set` on it with new decorations
whenever needed.
There are many possible design choices on where to put it, I opted to
put `editorDecorations` in `MonacoPane`, and have
`MonacoPane.createEditor` initialize it only in panes where decorations
are actually used.
Also some signatures changed which had a broad (but non-interesting)
impact.
2024-02-04 18:12:53 +02:00
Jeremy Rifkin
4260313e13 Common utilities and type work (#5200)
This PR refactors some common utilities out of lib/ and into shared/ and
eliminates some use of underscore.js, as well as general type
improvements done along the way.
2023-06-28 20:13:10 -04:00
Jeremy Rifkin
72e6b34d55 Improve pane typing (#5191)
Resolves #4365
2023-06-21 21:40:35 -04:00
Jeremy Rifkin
c779507000 Create a print view (#5161)
This PR adds a print view for CE

Closes #4617


![image](https://github.com/compiler-explorer/compiler-explorer/assets/51220084/92e5ceab-10cc-4289-a742-592e379627ef)

At the moment syntax highlighting isn't working. I think we need a way
to get style definitions from monaco. I've opened an issue at
https://github.com/microsoft/monaco-editor/issues/4031. For the CFG
pane, using the monaco classes "just works", but for some reason when
@media print is applied those definitions go away. We'd want to always
use light mode colors anyway.
2023-06-19 22:13:45 -04:00
Mats Jun Larsen
633eb82d18 Transition to ECMAScript Modules (#4780)
Makes the Compiler Explorer app, and all the tooling ESM compatible.
Things that have been done:

1. The package.json has `type: module` now
2. All relative imports have a .js ending
3. All directory imports are now directory/index.js to comply with ESM
standards
4. Dependency node-graceful is now imported into tree, because the
package is broken under esm
5. Dependency p-queue has been bumped to 7.x with ESM support
6. Dependency profanities has been bumped to 3.x with ESM support
7. Webpack config is now both ESM and CommonJS compatible
8. Non-ESM compatible imports have been rewritten
9. ESLint configuration has been tweaked to not fail on .js imports
10. Mocha is now hacked together and ran with ts-node-esm
11. Webpack is now hacked together and ran with ts-node-esm
12. Webpack config is now ESM compatible, so that it can be used in the
dev server
13. Cypress code still runs commonjs, and has been excluded from the
tsconfig
14. All sinon mock tests have been commented out, because sinon module
mocks do not work with ESModules (because ESModules are immutable)

A lot of tests are now giving warnings/errors to stdout, yet still pass.
Docenizer codegenerator scripts have been updated, but I did not re-run
them, and instead just changed their code.

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2023-02-27 18:06:38 -06:00
Patrick Quist
db69a5e813 automatically fix old gccdump states (#4641) 2023-01-25 22:03:51 +01:00
Jeremy Rifkin
07f37abe76 The War of The Types (#4490) 2023-01-13 19:22:25 -05:00
Rubén Rincón Blanco
f1a4f169a9 Fetch settings in initializeGlobalDependent (#4307) 2022-11-25 12:41:15 +01:00
partouf
d0f349cfc4 fix #4194 2022-10-24 11:55:20 +02:00
Rubén Rincón Blanco
ddafb32feb Try to fix main (#4173)
* Fix Editor not being able to load full links
* Better type for this.filename in compiler.ts
* Updates editor.ts and improves compilation types
* Fix some of the type issues, lots still remain
* fixes to language selection & refactoring of hub and some inits
* fix flow of events
* Fix llvm opt handling (cc @jeremy-rifkin)

Co-authored-by: partouf <partouf@gmail.com>
Co-authored-by: Matt Godbolt <matt@godbolt.org>
2022-10-22 13:59:51 -05:00
partouf
f28f86569c format and lintfixes 2022-10-12 18:07:32 +02:00
partouf
3fc49aa550 bugfixes device-view.ts 2022-10-12 17:42:25 +02:00
Rubén Rincón Blanco
7f7ca77fb2 Adds icon to Select all and makes the text hideable (#3970) 2022-08-19 09:13:49 +02:00
Mats Larsen
867adeff26 fix: patch missing jquery imports (#3952) 2022-08-10 23:24:12 +02:00
Mats Larsen
1f5fbe0e28 Replace provide-plugin jquery imports with import statements (#3943) 2022-08-07 11:58:16 +02:00
Mats Larsen
1d56ca21e5 fix: use interfaces in pane.ts and related files (#3930) 2022-07-30 10:02:35 +02:00
Rubén Rincón Blanco
330ca8deb1 Define the list of available eventHub events (#3686) 2022-05-27 22:55:42 +02:00
Jeremy Rifkin
14ddad0376 Jr/editor font size setting (#3670)
* Two quick code cleanups while I'm here

* Added default font size user setting

* Better addSelector solution

* Fix and clarification, thanks Ruben

* Updated typing

* Added font scale broadcast
2022-05-18 15:31:53 -04:00
Jeremy Rifkin
646e641b14 Fix resize bug (#3618) 2022-05-04 07:34:34 -05:00
Rubén Rincón Blanco
2dbca646f0 Address some low-hanging fruits from webstorm code inspection (#3582)
* Address some low-hanging fruits from webstorm code inspection
* Change editor code to silence eslint

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2022-04-29 14:24:29 -05:00
Rubén Rincón Blanco
7a9e30fbad Improve the TS implementation of the cfg view (#3549)
* Improve the TS implementation of the cfg view

* Change function name as suggested
2022-04-29 06:12:11 +02:00
Mats Larsen
fedde61a85 Fix noImplicitOverride errors (#3579) 2022-04-27 08:42:47 +02:00
Mats Larsen
4f9a34c511 Also enable prettier for recursive directories in static (#3539)
* Also enable prettier for recursive directories in static

* Fix formatting

* Fixes
2022-04-24 19:11:48 +02:00
Jeremy Rifkin
1daf79f735 Resolve @typescript-eslint/no-unnecessary-condition warnings for static/panes/ (#3535)
* Resolve unnecessary conditions for ast-view.ts

* Resolve unnecessary conditions for gnatdebug-view.ts

* Resolve unnecessary conditions for gnatdebugtree-view.ts

* Resolve unnecessary conditions for ir-view.ts

* Resolve unnecessary conditions for opt-view.ts

* Resolve unnecessary conditions for pane.ts

* Resolve unnecessary conditions for pp-view.ts

* Resolve unnecessary conditions for rusthir-view.ts

* Resolve unnecessary conditions for rustmacroexp-view.ts

* Resolve unnecessary conditions for rustmir-view.ts

* Resolve unnecessary conditions for tree.ts
2022-04-23 23:04:29 +02:00
Mats Larsen
b48efe333b Use Hub and EventHub types in codebase (#3482) 2022-04-02 22:35:17 +01:00
Matt Godbolt
5030dcbcba Fix monaco button registration 2022-02-26 13:57:42 -06:00
Matt Godbolt
d27c9980dd Extract a Pane base separate from a MonacoPane. (#3385)
* Extract a Pane base separate from a MonacoPane.
* Make it clearer that editor and tree id are truthy-ish non-zero numbers, or else not present. Thanks @partouf; CC @jeremy-rifkin

Paves the way to move the (few) tools that don't have an editor to also share the base class.
2022-02-26 13:29:54 -06:00
Jeremy Rifkin
17b4f2ebc4 Fix Editor #false bug (#3360)
* Fix Editor: #false bug
* Refactoring, a couple small fixes to handling, and made changes for opt view
* Fixed Editor #false bug for diff pane
2022-02-23 07:46:40 -06:00
Rubén Rincón Blanco
48eee26d2c Group some files to their own folders (#3384)
* Group some files to their own folders

In etc/scripts/, added disasms/, docenizers/, and util/ folders
In lib/, added mapfiles/, and parsers/ folders (+moved google.js to
shortener)
In static/, added widgets/ folder

Added cypress folder to .gitignore

* Address Matt's PR reviews

* Move new Pane renaming to folder
2022-02-22 00:18:21 +01:00
Luca Natilla
26cbd6e63c Pane renaming saves the name of the panes into their state (#3364)
* Renaming works for compiler with local storage saving

* Remove closed panes from local storage

* Feature working for almost every pane

* Working except for editor and tool-input-view

* Save pane name into its state instead of local storage

* Remove unnecessary local storage code

* Apply Ruben's suggestions

* Check for CMakeLists.txt always on default name

* Change pane renaming's modal placeholder's text, code cleanup
2022-02-22 00:07:31 +01:00
Rubén Rincón Blanco
db229b94bc Add strict tsc flag for the frontend ts code (#3356) 2022-02-12 02:41:01 +01:00
Luca Natilla
810cb5ad6f Ability to name panes (#3323) 2022-02-11 15:25:02 +01:00
Rubén Rincón Blanco
42c7b2b694 Make eslint work on static ts files (#3304) 2022-02-03 18:04:50 +01:00
Rubén Rincón Blanco
f4315c561b Move static/settings.js to TypeScript (#3297)
* Rename settings.js to ts

* Move Settings to TS

* Remove underscore from settings

* Update static/settings.ts

Co-authored-by: Mats Larsen <me@supergrecko.com>

* Update static/settings.ts

Co-authored-by: Mats Larsen <me@supergrecko.com>

* Improve Settings implementation

* Move Settings interfaces to same file

* Update static/settings.ts

Co-authored-by: Mats Larsen <me@supergrecko.com>

Co-authored-by: Mats Larsen <me@supergrecko.com>
2022-01-29 02:00:10 +01:00
RabsRincon
9c2528000e Move fontscale to typescript 2021-12-31 11:08:21 +01:00
Mats Larsen
60217a8e61 Make the TypeScript Pane API easier to work with (#3034)
This is a refactor for core methods of the Pane API. In this patch:

1. Rename initializeDOMRoot to getInitialHTML() - This logic is common for all of the panes. Returning the HTML is more type-safe and makes the method pure.
2. Make createEditor return the monaco editor - Allows us to set the editor in the constructor. Returning the editor is more type-safe and makes the method pure.
3. Rename id parameters to compilerId in onCompileResult, onCompiler and onCompilerClose - It's not easy to tell what these ids were, this makes it easier to understand what we're using here.
4. Type compiler, options and result as unkown in onCompiler, onCompileResult - These parameters don't have types at the moment, so it's safer for implementors to manually override and type as any/whichever type they wish.
5. Add plenty of code documentation to onCompiler and onCompileResult
2021-10-14 15:16:40 +02:00
Mats Larsen
0a5877b91b Add method to Pane for implementing editor actions (#3033)
This feature was already implemented on a lot of the older panes. It is now available for the new TypeScript Pane API.
2021-10-14 12:13:47 +02:00
Mats Larsen
896cf2f9ca Decouple each pane state from the base pane state (#3025)
Decouples the individual initial pane states for each pane from the BasePaneState type.

This will allow easier re-use of the state the various constructors receive

Non-functional change.
2021-10-12 00:03:50 +02:00
Mats Larsen
d93bd31f40 Add base Pane component and migrate RustMirView to TypeScript (#2917)
* Implement generic pane skeleton

* Implement abstract Pane class

* Port RustMirView to typescript

* Fix nits in code

* Adjust method names and add override modifiers

* Add remaining settings keys (and fix a bug)

* Use this-binding in registerStandardCallbacks

* Address review comments

* Use utils.updateAndCalcTopBarHeight in base pane

* Add notice about adding an entry in interfaces.ts

* Use .bind instead of context parameter

GoldenLayout has moved away from the context parameter, so .bind is a safer for the future

* [200~Check for editor presence + fix typo~

* Remove trailing comma

Co-authored-by: Patrick Quist <partouf@gmail.com>
2021-09-10 23:42:47 +02:00