Commit Graph

26 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
2a4e688ff2 Fix null reference errors in gccdump view selection handling (#7764)
## Summary

Fixes two related null reference errors in the GCC dump view's TomSelect
dropdown handling that occur during user interactions.

## Root Cause Analysis

**COMPILER-EXPLORER-96P** (1067 occurrences):
- Error: `TypeError: undefined is not an object (evaluating
't.filename_suffix')`
- Location: `gccdump-view.ts:318` in `onPassSelect()`
- Trigger: User deletes a selection via TomSelect → `deleteSelection()`
→ `removeItem()` → `trigger('change')` → `onPassSelect()` called with
passId that no longer exists in `this.selectize.options`

**COMPILER-EXPLORER-E44** (34 occurrences):
- Error: `TypeError: Cannot read properties of undefined (reading '0')`
- Location: `gccdump-view.ts:237` in dropdown open handler
- Trigger: `find()` returns undefined when searching for pass by
filename_suffix, but code uses non-null assertion `activeOption![0]`

Both errors occur due to timing issues when dropdown options are being
updated while user interactions are happening.

## Changes

1. **Added null check in `onPassSelect()`**: Safely handle case where
`this.selectize.options[passId]` returns undefined
2. **Removed unsafe non-null assertion**: Replace `activeOption![0]`
with proper null check and early return
3. **Added CLAUDE.md guidance**: Include preference for modern
TypeScript features like optional chaining

## Impact

- Prevents crashes with 1100+ reported occurrences combined
- Maintains existing user experience - dropdowns continue to work
normally
- No behavioral changes for valid interactions

Fixes COMPILER-EXPLORER-96P
Fixes COMPILER-EXPLORER-E44

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-09 11:00:27 -05:00
Ofek
32a8e23185 Fix #7464: resolve TomSelect glitch by delaying active option setting (#7558)
<!-- 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!
-->

Co-authored-by: Ofek Shilon <oshilon@speedata.io>
2025-04-11 16:07:40 +03:00
Ofek
be9b6f3bd7 Fix #7464: need both clear and clearOptions on gccdump's TomSelect (#7465) 2025-02-28 21:41:39 +02:00
Ofek
05d390b742 Fix #7296: clearOptions instead of clear for gcc pass selector (#7451) 2025-02-25 23:36:13 +02:00
Mats Jun Larsen
5eea63328f Migrate to Biome for linting and formatting (#7033) 2025-02-02 17:54:31 +00:00
Ofek
20b8ccaa6f Remove ICompiler, other minor type fixes (#7079) 2024-11-25 18:36:20 +02:00
Ofek
c1985d64a1 Tsification binge #7 (#6974) 2024-10-25 12:19:04 +03: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
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
Ofek
cce6125929 Fix #5820 (#5831)
The same dropdown glitch described in the bug happens for the compiler
selection dropdown. This addresses both.
2023-12-10 14:06:45 -06:00
Jeremy Rifkin
b134451b7d Add gimple front-end syntax option for gcc tree/rtl viewer (#5816)
This PR adds an option to the gcc tree/rtl dump viewer to dump syntax
that the gimple frontend can accept


![image](https://github.com/compiler-explorer/compiler-explorer/assets/51220084/4a5ff503-9420-4fc3-ba6f-6b1dc196e938)
2023-11-29 09:42:38 -05: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
Jeremy Rifkin
384c297906 Fix trailing comma issue (#4775)
Make trailing commas more consistent throughout the project, fixes
config conflict between eslint and prettier. Resolves an oversight in
#4766.
2023-02-26 12:21:35 -05: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
Matt Godbolt
a436592401 npm run format 2022-12-01 21:13:50 -06:00
Marc Poulhiès
9d3096d2cc fix: Gcc dump types (#4369)
While doing some cleaning, the typing of the GCC dump feature was found
incorrect. This change tries to fix most of it... But some details still need to
be fixed (FIXME notes left in the code).

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2022-11-30 20:41:15 +01:00
Marc Poulhiès
2fa2bbb16a refactor: renames the CompilerFilters type (#4346)
The type which probably started as a real enum of possible post filtering
options now also includes options used for compilers' invocations.

The type was already split, but the naming was not reflecting this in the other
part of the code.

This changes tries to apply a simple renaming to the type only (corresponding
variables are left as 'filters').

While doing so, some typing error were discovered around the GccDump feature.
A fix for this will follow in a different PR.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2022-11-28 21:37:15 +01:00
partouf
223cd8f5e2 stray console logs 2022-08-25 23:59:14 +02:00
Mats Larsen
1f5fbe0e28 Replace provide-plugin jquery imports with import statements (#3943) 2022-08-07 11:58:16 +02:00
Patrick Quist
8dc552af28 Fix gccdump (#3888) 2022-07-19 21:10:39 +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
44a9ab7d46 Convert gccdump-view to typescript (#3575)
* Converted gccdump-view to typescript
* Eliminate more uses of underscore.js
2022-04-29 14:14:33 -05:00