Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
d21e5e6
Use Int.toString instead of Belt.Int.toString for ReScript v11+
mediremi May 1, 2025
573b863
Use more padding and set max default content width in React and Conso…
mediremi May 1, 2025
06bf524
Show error and problem counts in 'Problems' tab title
mediremi May 1, 2025
c5e8621
Only show syntax selection if there are at least 2 syntaxes to choose…
mediremi May 1, 2025
fd86598
Update TailwindCSS to v3.4.17 to get extended min-width, max-width, a…
mediremi May 1, 2025
92bb2ea
Set min-width on problem counts
mediremi May 1, 2025
7a4ce15
Only reset warning flags, not other config, when clicking warning fla…
mediremi May 1, 2025
ec20549
Add missing warning flag description
mediremi May 1, 2025
9760eda
Remove warning flags that no longer exist
mediremi May 1, 2025
8553e6b
Improve styles for warnings flags input
mediremi May 1, 2025
39527e5
Remove warnings 61 and 109 from default warn flags
mediremi May 1, 2025
6d80d6c
Refactor ToggleSelection component
mediremi May 1, 2025
cfaa584
Remove outdated TODOs
mediremi May 1, 2025
dad68a1
Remove unused OCaml variant in RescriptCompilerApi.Lang.t
mediremi May 1, 2025
2f7cd58
Remove unused RescriptCompilerApi.Compiler.ocamlCompile
mediremi May 1, 2025
5e74246
Remove warning flag descriptions for flags that no longer exist
mediremi May 1, 2025
2384d4c
Merge branch 'master' into playground-tweaks
mediremi May 1, 2025
7beeea0
Move problem counts to after 'Problems' tab title
mediremi May 2, 2025
0afa602
Restore warnings flags reset value to support older compilers
mediremi May 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Only reset warning flags, not other config, when clicking warning fla…
…g reset button
  • Loading branch information
mediremi committed May 1, 2025
commit 7a4ce1598339b0360bebccf51bf93ba7420d3e07
37 changes: 9 additions & 28 deletions src/Playground.res
Original file line number Diff line number Diff line change
Expand Up @@ -793,20 +793,12 @@ module WarningFlagsWidget = {
| []
| [{enabled: false, flag: "a"}] => React.null
| _ =>
let onMouseDown = evt => {
ReactEvent.Mouse.preventDefault(evt)
let onClick = _evt => {
onUpdate([{WarningFlagDescription.Parser.enabled: false, flag: "a"}])
}

// For iOS12 compat
let onClick = _ => ()
let onFocus = evt => {
ReactEvent.Focus.preventDefault(evt)
ReactEvent.Focus.stopPropagation(evt)
}

<button
onMouseDown
title="Clear all flags"
onClick
onFocus
tabIndex=0
Expand Down Expand Up @@ -891,23 +883,11 @@ module Settings = {

let warnFlagTokens = WarningFlagDescription.Parser.parse(warn_flags)->Result.getOr([])

let onResetClick = evt => {
ReactEvent.Mouse.preventDefault(evt)

let open_modules = switch readyState.selected.apiVersion {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is gone? We still need this (for v11 at least).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed this callback to onWarningFlagsResetClick to make it clearer that this is triggered by clicking on [reset] in the 'Warnings flags' section of the settings panel.

Copy link
Member Author

@mediremi mediremi May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the open_modules update part of this function as:
i) there's no way for users to configure open modules (at least as far as I can tell)
ii) the updating of open_modules on compiler load and switch is actually managed by the useEffect in CompilerManagerHook - this was just duplicated logic from CompilerManagerHook.getOpenModules

| V1 | V2 | V3 | UnknownVersion(_) => None
| V4 | V5 =>
readyState.selected.libraries->Array.some(el => el === "@rescript/core")
? Some(["RescriptCore"])
: None
}

let defaultConfig = {
Api.Config.module_system: "nodejs",
warn_flags: "+a-4-9-20-40-41-42-50-61-102-109",
?open_modules,
}
setConfig(defaultConfig)
let onWarningFlagsResetClick = _evt => {
setConfig({
...config,
warn_flags: "+a-4-9-20-40-41-50-61-102-109",
})
}

let onCompilerSelect = id => dispatch(SwitchToCompiler(id))
Expand Down Expand Up @@ -1028,7 +1008,8 @@ module Settings = {
<div className="mt-8">
<div className=titleClass>
{React.string("Warning Flags")}
<button onMouseDown=onResetClick className={"ml-6 text-12 " ++ Text.Link.standalone}>
<button
onClick=onWarningFlagsResetClick className={"ml-6 text-12 " ++ Text.Link.standalone}>
{React.string("[reset]")}
</button>
</div>
Expand Down