From 3f660370977282d147137f0fe4b97beba29d5865 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Thu, 6 May 2021 00:36:08 +0200 Subject: [PATCH 1/3] Add heuristic for lowercase jsx. Show the type of, and jump to, `createDOMElementVariadic`. --- CHANGELOG.md | 1 + analysis/src/References.ml | 13 ++++++++----- analysis/tests/src/Div.res | 3 +++ analysis/tests/src/expected/Div.res.txt | 3 +++ 4 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 analysis/tests/src/Div.res create mode 100644 analysis/tests/src/expected/Div.res.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a641c094..28850d9d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - Autocomplete for function calls: only suggest labeled args that were not yet assigned. - Add support for recursive modules. - Add support for transitive module references. +- Add heuristic for lowercase jsx. ## 1.1.1 diff --git a/analysis/src/References.ml b/analysis/src/References.ml index 70a395381..ef384bf50 100644 --- a/analysis/src/References.ml +++ b/analysis/src/References.ml @@ -19,26 +19,29 @@ let locItemsForPos ~extra pos = let locItemForPos ~full pos = let locItems = locItemsForPos ~extra:full.extra pos in - if !Log.spamError then + if !Log.spamError then print_endline ("locItems:\n" ^ (locItems |> List.map locItemToString |> String.concat "\n")); match locItems with - | _ :: _ :: _ :: ({locType = Typed ("makeProps", _, _)} as l) :: _ + | _ :: _ :: _ :: ({locType = Typed ("makeProps", _, _)} as li) :: _ when full.file.uri |> Uri2.isInterface -> (* heuristic for makeProps in interface files *) - Some l + Some li | [ {locType = Typed ("fragment", _, _)}; {locType = Typed ("createElement", _, _)}; ] -> (* heuristic for within a fragment *) None + | [{locType = Constant _}; ({locType = Typed ("createDOMElementVariadic", _, _)} as li2)] -> + (* heuristic for
*) + Some li2 | {locType = Typed ("makeProps", _, _)} - :: ({locType = Typed ("make", _, _)} as l2) :: _ -> + :: ({locType = Typed ("make", _, _)} as li2) :: _ -> (* heuristic for within fragments: take make as makeProps does not work the type is not greatl but jump to definition works *) - Some l2 + Some li2 | [({locType = Typed (_, _, LocalReference _)} as li1); li3] when li1.loc = li3.loc -> (* JSX and compiler combined: diff --git a/analysis/tests/src/Div.res b/analysis/tests/src/Div.res new file mode 100644 index 000000000..919fb1d79 --- /dev/null +++ b/analysis/tests/src/Div.res @@ -0,0 +1,3 @@ + +let q =
+// ^hov \ No newline at end of file diff --git a/analysis/tests/src/expected/Div.res.txt b/analysis/tests/src/expected/Div.res.txt new file mode 100644 index 000000000..0c58456a0 --- /dev/null +++ b/analysis/tests/src/expected/Div.res.txt @@ -0,0 +1,3 @@ +Hover tests/src/Div.res 1:10 +{"contents": "```rescript\n(\n string,\n ~?props: ReactDOMRe.domProps,\n array,\n) => React.element\n```"} + From f612d19c467d729b087938b94f44a9d19e9cc97c Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Thu, 6 May 2021 00:58:12 +0200 Subject: [PATCH 2/3] Autocomplete for lowercase JSX. Fixes https://github.com/rescript-lang/rescript-vscode/issues/179 --- CHANGELOG.md | 1 + analysis/src/NewCompletions.ml | 1034 ++++++++++++++++- analysis/src/PartialParser.ml | 2 +- analysis/tests/src/Div.res | 4 +- .../tests/src/expected/Completion.res.txt | 8 +- analysis/tests/src/expected/Div.res.txt | 21 + analysis/tests/src/expected/Jsx.res.txt | 32 +- 7 files changed, 1075 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28850d9d6..87c4b1290 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Add support for recursive modules. - Add support for transitive module references. - Add heuristic for lowercase jsx. +- Add autocomplete for lowercase jsx. ## 1.1.1 diff --git a/analysis/src/NewCompletions.ml b/analysis/src/NewCompletions.ml index 56ee34e2a..9d6dc73bd 100644 --- a/analysis/src/NewCompletions.ml +++ b/analysis/src/NewCompletions.ml @@ -430,6 +430,1030 @@ let mkItem ~name ~kind ~detail ~deprecated ~docstring = let processCompletable ~findItems ~package ~rawOpens (completable : PartialParser.completable) = match completable with + | Cjsx ([id], prefix, identsSeen) when String.lowercase_ascii id = id -> + let labels = [("aria-details", "string"); ("aria-disabled", "bool")] in + (* + @optional @as("aria-details") + ariaDetails: string, + @optional @as("aria-disabled") + ariaDisabled: bool, + @optional @as("aria-hidden") + ariaHidden: bool, + /* [@optional] [@as "aria-invalid"] ariaInvalid: grammar|false|spelling|true, */ + @optional @as("aria-keyshortcuts") + ariaKeyshortcuts: string, + @optional @as("aria-label") + ariaLabel: string, + @optional @as("aria-roledescription") + ariaRoledescription: string, + /* Widget Attributes */ + /* [@optional] [@as "aria-autocomplete"] ariaAutocomplete: inline|list|both|none, */ + /* [@optional] [@as "aria-checked"] ariaChecked: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */ + @optional @as("aria-expanded") + ariaExpanded: bool, + /* [@optional] [@as "aria-haspopup"] ariaHaspopup: false|true|menu|listbox|tree|grid|dialog, */ + @optional @as("aria-level") + ariaLevel: int, + @optional @as("aria-modal") + ariaModal: bool, + @optional @as("aria-multiline") + ariaMultiline: bool, + @optional @as("aria-multiselectable") + ariaMultiselectable: bool, + /* [@optional] [@as "aria-orientation"] ariaOrientation: horizontal|vertical|undefined, */ + @optional @as("aria-placeholder") + ariaPlaceholder: string, + /* [@optional] [@as "aria-pressed"] ariaPressed: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */ + @optional @as("aria-readonly") + ariaReadonly: bool, + @optional @as("aria-required") + ariaRequired: bool, + @optional @as("aria-selected") + ariaSelected: bool, + @optional @as("aria-sort") + ariaSort: string, + @optional @as("aria-valuemax") + ariaValuemax: float, + @optional @as("aria-valuemin") + ariaValuemin: float, + @optional @as("aria-valuenow") + ariaValuenow: float, + @optional @as("aria-valuetext") + ariaValuetext: string, + /* Live Region Attributes */ + @optional @as("aria-atomic") + ariaAtomic: bool, + @optional @as("aria-busy") + ariaBusy: bool, + /* [@optional] [@as "aria-live"] ariaLive: off|polite|assertive|rude, */ + @optional @as("aria-relevant") + ariaRelevant: string, + /* Drag-and-Drop Attributes */ + /* [@optional] [@as "aria-dropeffect"] ariaDropeffect: copy|move|link|execute|popup|none, */ + @optional @as("aria-grabbed") + ariaGrabbed: bool, + /* Relationship Attributes */ + @optional @as("aria-activedescendant") + ariaActivedescendant: string, + @optional @as("aria-colcount") + ariaColcount: int, + @optional @as("aria-colindex") + ariaColindex: int, + @optional @as("aria-colspan") + ariaColspan: int, + @optional @as("aria-controls") + ariaControls: string, + @optional @as("aria-describedby") + ariaDescribedby: string, + @optional @as("aria-errormessage") + ariaErrormessage: string, + @optional @as("aria-flowto") + ariaFlowto: string, + @optional @as("aria-labelledby") + ariaLabelledby: string, + @optional @as("aria-owns") + ariaOwns: string, + @optional @as("aria-posinset") + ariaPosinset: int, + @optional @as("aria-rowcount") + ariaRowcount: int, + @optional @as("aria-rowindex") + ariaRowindex: int, + @optional @as("aria-rowspan") + ariaRowspan: int, + @optional @as("aria-setsize") + ariaSetsize: int, + /* react textarea/input */ + @optional + defaultChecked: bool, + @optional + defaultValue: string, + /* global html attributes */ + @optional + accessKey: string, + @optional + className: string /* substitute for "class" */, + @optional + contentEditable: bool, + @optional + contextMenu: string, + @optional + dir: string /* "ltr", "rtl" or "auto" */, + @optional + draggable: bool, + @optional + hidden: bool, + @optional + id: string, + @optional + lang: string, + @optional + role: string /* ARIA role */, + @optional + style: style, + @optional + spellCheck: bool, + @optional + tabIndex: int, + @optional + title: string, + /* html5 microdata */ + @optional + itemID: string, + @optional + itemProp: string, + @optional + itemRef: string, + @optional + itemScope: bool, + @optional + itemType: string /* uri */, + /* tag-specific html attributes */ + @optional + accept: string, + @optional + acceptCharset: string, + @optional + action: string /* uri */, + @optional + allowFullScreen: bool, + @optional + alt: string, + @optional + async: bool, + @optional + autoComplete: string /* has a fixed, but large-ish, set of possible values */, + @optional + autoCapitalize: string /* Mobile Safari specific */, + @optional + autoFocus: bool, + @optional + autoPlay: bool, + @optional + challenge: string, + @optional + charSet: string, + @optional + checked: bool, + @optional + cite: string /* uri */, + @optional + crossOrigin: string /* anonymous, use-credentials */, + @optional + cols: int, + @optional + colSpan: int, + @optional + content: string, + @optional + controls: bool, + @optional + coords: string /* set of values specifying the coordinates of a region */, + @optional + data: string /* uri */, + @optional + dateTime: string /* "valid date string with optional time" */, + @optional + default: bool, + @optional + defer: bool, + @optional + disabled: bool, + @optional + download: string /* should really be either a boolean, signifying presence, or a string */, + @optional + encType: string /* "application/x-www-form-urlencoded", "multipart/form-data" or "text/plain" */, + @optional + form: string, + @optional + formAction: string /* uri */, + @optional + formTarget: string /* "_blank", "_self", etc. */, + @optional + formMethod: string /* "post", "get", "put" */, + @optional + headers: string, + @optional + height: string /* in html5 this can only be a number, but in html4 it can ba a percentage as well */, + @optional + high: int, + @optional + href: string /* uri */, + @optional + hrefLang: string, + @optional + htmlFor: string /* substitute for "for" */, + @optional + httpEquiv: string /* has a fixed set of possible values */, + @optional + icon: string /* uri? */, + @optional + inputMode: string /* "verbatim", "latin", "numeric", etc. */, + @optional + integrity: string, + @optional + keyType: string, + @optional + kind: string /* has a fixed set of possible values */, + @optional + label: string, + @optional + list: string, + @optional + loop: bool, + @optional + low: int, + @optional + manifest: string /* uri */, + @optional + max: string /* should be int or Js.Date.t */, + @optional + maxLength: int, + @optional + media: string /* a valid media query */, + @optional + mediaGroup: string, + @optional + method: string /* "post" or "get" */, + @optional + min: string, + @optional + minLength: int, + @optional + multiple: bool, + @optional + muted: bool, + @optional + name: string, + @optional + nonce: string, + @optional + noValidate: bool, + @optional @as("open") + open_: bool /* use this one. Previous one is deprecated */, + @optional + optimum: int, + @optional + pattern: string /* valid Js RegExp */, + @optional + placeholder: string, + @optional + playsInline: bool, + @optional + poster: string /* uri */, + @optional + preload: string /* "none", "metadata" or "auto" (and "" as a synonym for "auto") */, + @optional + radioGroup: string, + @optional + readOnly: bool, + @optional + rel: string /* a space- or comma-separated (depending on the element) list of a fixed set of "link types" */, + @optional + required: bool, + @optional + reversed: bool, + @optional + rows: int, + @optional + rowSpan: int, + @optional + sandbox: string /* has a fixed set of possible values */, + @optional + scope: string /* has a fixed set of possible values */, + @optional + scoped: bool, + @optional + scrolling: string /* html4 only, "auto", "yes" or "no" */, + /* seamless - supported by React, but removed from the html5 spec */ + @optional + selected: bool, + @optional + shape: string, + @optional + size: int, + @optional + sizes: string, + @optional + span: int, + @optional + src: string /* uri */, + @optional + srcDoc: string, + @optional + srcLang: string, + @optional + srcSet: string, + @optional + start: int, + @optional + step: float, + @optional + summary: string /* deprecated */, + @optional + target: string, + @optional @as("type") + type_: string /* has a fixed but large-ish set of possible values */ /* use this one. Previous one is deprecated */, + @optional + useMap: string, + @optional + value: string, + @optional + width: string /* in html5 this can only be a number, but in html4 it can ba a percentage as well */, + @optional + wrap: string /* "hard" or "soft" */, + /* Clipboard events */ + @optional + onCopy: ReactEvent.Clipboard.t => unit, + @optional + onCut: ReactEvent.Clipboard.t => unit, + @optional + onPaste: ReactEvent.Clipboard.t => unit, + /* Composition events */ + @optional + onCompositionEnd: ReactEvent.Composition.t => unit, + @optional + onCompositionStart: ReactEvent.Composition.t => unit, + @optional + onCompositionUpdate: ReactEvent.Composition.t => unit, + /* Keyboard events */ + @optional + onKeyDown: ReactEvent.Keyboard.t => unit, + @optional + onKeyPress: ReactEvent.Keyboard.t => unit, + @optional + onKeyUp: ReactEvent.Keyboard.t => unit, + /* Focus events */ + @optional + onFocus: ReactEvent.Focus.t => unit, + @optional + onBlur: ReactEvent.Focus.t => unit, + /* Form events */ + @optional + onChange: ReactEvent.Form.t => unit, + @optional + onInput: ReactEvent.Form.t => unit, + @optional + onSubmit: ReactEvent.Form.t => unit, + @optional + onInvalid: ReactEvent.Form.t => unit, + /* Mouse events */ + @optional + onClick: ReactEvent.Mouse.t => unit, + @optional + onContextMenu: ReactEvent.Mouse.t => unit, + @optional + onDoubleClick: ReactEvent.Mouse.t => unit, + @optional + onDrag: ReactEvent.Mouse.t => unit, + @optional + onDragEnd: ReactEvent.Mouse.t => unit, + @optional + onDragEnter: ReactEvent.Mouse.t => unit, + @optional + onDragExit: ReactEvent.Mouse.t => unit, + @optional + onDragLeave: ReactEvent.Mouse.t => unit, + @optional + onDragOver: ReactEvent.Mouse.t => unit, + @optional + onDragStart: ReactEvent.Mouse.t => unit, + @optional + onDrop: ReactEvent.Mouse.t => unit, + @optional + onMouseDown: ReactEvent.Mouse.t => unit, + @optional + onMouseEnter: ReactEvent.Mouse.t => unit, + @optional + onMouseLeave: ReactEvent.Mouse.t => unit, + @optional + onMouseMove: ReactEvent.Mouse.t => unit, + @optional + onMouseOut: ReactEvent.Mouse.t => unit, + @optional + onMouseOver: ReactEvent.Mouse.t => unit, + @optional + onMouseUp: ReactEvent.Mouse.t => unit, + /* Selection events */ + @optional + onSelect: ReactEvent.Selection.t => unit, + /* Touch events */ + @optional + onTouchCancel: ReactEvent.Touch.t => unit, + @optional + onTouchEnd: ReactEvent.Touch.t => unit, + @optional + onTouchMove: ReactEvent.Touch.t => unit, + @optional + onTouchStart: ReactEvent.Touch.t => unit, + // Pointer events + @optional + onPointerOver: ReactEvent.Pointer.t => unit, + @optional + onPointerEnter: ReactEvent.Pointer.t => unit, + @optional + onPointerDown: ReactEvent.Pointer.t => unit, + @optional + onPointerMove: ReactEvent.Pointer.t => unit, + @optional + onPointerUp: ReactEvent.Pointer.t => unit, + @optional + onPointerCancel: ReactEvent.Pointer.t => unit, + @optional + onPointerOut: ReactEvent.Pointer.t => unit, + @optional + onPointerLeave: ReactEvent.Pointer.t => unit, + @optional + onGotPointerCapture: ReactEvent.Pointer.t => unit, + @optional + onLostPointerCapture: ReactEvent.Pointer.t => unit, + /* UI events */ + @optional + onScroll: ReactEvent.UI.t => unit, + /* Wheel events */ + @optional + onWheel: ReactEvent.Wheel.t => unit, + /* Media events */ + @optional + onAbort: ReactEvent.Media.t => unit, + @optional + onCanPlay: ReactEvent.Media.t => unit, + @optional + onCanPlayThrough: ReactEvent.Media.t => unit, + @optional + onDurationChange: ReactEvent.Media.t => unit, + @optional + onEmptied: ReactEvent.Media.t => unit, + @optional + onEncrypetd: ReactEvent.Media.t => unit, + @optional + onEnded: ReactEvent.Media.t => unit, + @optional + onError: ReactEvent.Media.t => unit, + @optional + onLoadedData: ReactEvent.Media.t => unit, + @optional + onLoadedMetadata: ReactEvent.Media.t => unit, + @optional + onLoadStart: ReactEvent.Media.t => unit, + @optional + onPause: ReactEvent.Media.t => unit, + @optional + onPlay: ReactEvent.Media.t => unit, + @optional + onPlaying: ReactEvent.Media.t => unit, + @optional + onProgress: ReactEvent.Media.t => unit, + @optional + onRateChange: ReactEvent.Media.t => unit, + @optional + onSeeked: ReactEvent.Media.t => unit, + @optional + onSeeking: ReactEvent.Media.t => unit, + @optional + onStalled: ReactEvent.Media.t => unit, + @optional + onSuspend: ReactEvent.Media.t => unit, + @optional + onTimeUpdate: ReactEvent.Media.t => unit, + @optional + onVolumeChange: ReactEvent.Media.t => unit, + @optional + onWaiting: ReactEvent.Media.t => unit, + /* Image events */ + @optional + onLoad: ReactEvent.Image.t => unit /* duplicate */ /* ~onError: ReactEvent.Image.t => unit=?, */, + /* Animation events */ + @optional + onAnimationStart: ReactEvent.Animation.t => unit, + @optional + onAnimationEnd: ReactEvent.Animation.t => unit, + @optional + onAnimationIteration: ReactEvent.Animation.t => unit, + /* Transition events */ + @optional + onTransitionEnd: ReactEvent.Transition.t => unit, + /* svg */ + @optional + accentHeight: string, + @optional + accumulate: string, + @optional + additive: string, + @optional + alignmentBaseline: string, + @optional + allowReorder: string, + @optional + alphabetic: string, + @optional + amplitude: string, + @optional + arabicForm: string, + @optional + ascent: string, + @optional + attributeName: string, + @optional + attributeType: string, + @optional + autoReverse: string, + @optional + azimuth: string, + @optional + baseFrequency: string, + @optional + baseProfile: string, + @optional + baselineShift: string, + @optional + bbox: string, + @optional @as("begin") + begin_: string /* use this one. Previous one is deprecated */, + @optional + bias: string, + @optional + by: string, + @optional + calcMode: string, + @optional + capHeight: string, + @optional + clip: string, + @optional + clipPath: string, + @optional + clipPathUnits: string, + @optional + clipRule: string, + @optional + colorInterpolation: string, + @optional + colorInterpolationFilters: string, + @optional + colorProfile: string, + @optional + colorRendering: string, + @optional + contentScriptType: string, + @optional + contentStyleType: string, + @optional + cursor: string, + @optional + cx: string, + @optional + cy: string, + @optional + d: string, + @optional + decelerate: string, + @optional + descent: string, + @optional + diffuseConstant: string, + @optional + direction: string, + @optional + display: string, + @optional + divisor: string, + @optional + dominantBaseline: string, + @optional + dur: string, + @optional + dx: string, + @optional + dy: string, + @optional + edgeMode: string, + @optional + elevation: string, + @optional + enableBackground: string, + @optional @as("end") + end_: string /* use this one. Previous one is deprecated */, + @optional + exponent: string, + @optional + externalResourcesRequired: string, + @optional + fill: string, + @optional + fillOpacity: string, + @optional + fillRule: string, + @optional + filter: string, + @optional + filterRes: string, + @optional + filterUnits: string, + @optional + floodColor: string, + @optional + floodOpacity: string, + @optional + focusable: string, + @optional + fontFamily: string, + @optional + fontSize: string, + @optional + fontSizeAdjust: string, + @optional + fontStretch: string, + @optional + fontStyle: string, + @optional + fontVariant: string, + @optional + fontWeight: string, + @optional + fomat: string, + @optional + from: string, + @optional + fx: string, + @optional + fy: string, + @optional + g1: string, + @optional + g2: string, + @optional + glyphName: string, + @optional + glyphOrientationHorizontal: string, + @optional + glyphOrientationVertical: string, + @optional + glyphRef: string, + @optional + gradientTransform: string, + @optional + gradientUnits: string, + @optional + hanging: string, + @optional + horizAdvX: string, + @optional + horizOriginX: string, + @optional + ideographic: string, + @optional + imageRendering: string, + @optional @as("in") + in_: string /* use this one. Previous one is deprecated */, + @optional + in2: string, + @optional + intercept: string, + @optional + k: string, + @optional + k1: string, + @optional + k2: string, + @optional + k3: string, + @optional + k4: string, + @optional + kernelMatrix: string, + @optional + kernelUnitLength: string, + @optional + kerning: string, + @optional + keyPoints: string, + @optional + keySplines: string, + @optional + keyTimes: string, + @optional + lengthAdjust: string, + @optional + letterSpacing: string, + @optional + lightingColor: string, + @optional + limitingConeAngle: string, + @optional + local: string, + @optional + markerEnd: string, + @optional + markerHeight: string, + @optional + markerMid: string, + @optional + markerStart: string, + @optional + markerUnits: string, + @optional + markerWidth: string, + @optional + mask: string, + @optional + maskContentUnits: string, + @optional + maskUnits: string, + @optional + mathematical: string, + @optional + mode: string, + @optional + numOctaves: string, + @optional + offset: string, + @optional + opacity: string, + @optional + operator: string, + @optional + order: string, + @optional + orient: string, + @optional + orientation: string, + @optional + origin: string, + @optional + overflow: string, + @optional + overflowX: string, + @optional + overflowY: string, + @optional + overlinePosition: string, + @optional + overlineThickness: string, + @optional + paintOrder: string, + @optional + panose1: string, + @optional + pathLength: string, + @optional + patternContentUnits: string, + @optional + patternTransform: string, + @optional + patternUnits: string, + @optional + pointerEvents: string, + @optional + points: string, + @optional + pointsAtX: string, + @optional + pointsAtY: string, + @optional + pointsAtZ: string, + @optional + preserveAlpha: string, + @optional + preserveAspectRatio: string, + @optional + primitiveUnits: string, + @optional + r: string, + @optional + radius: string, + @optional + refX: string, + @optional + refY: string, + @optional + renderingIntent: string, + @optional + repeatCount: string, + @optional + repeatDur: string, + @optional + requiredExtensions: string, + @optional + requiredFeatures: string, + @optional + restart: string, + @optional + result: string, + @optional + rotate: string, + @optional + rx: string, + @optional + ry: string, + @optional + scale: string, + @optional + seed: string, + @optional + shapeRendering: string, + @optional + slope: string, + @optional + spacing: string, + @optional + specularConstant: string, + @optional + specularExponent: string, + @optional + speed: string, + @optional + spreadMethod: string, + @optional + startOffset: string, + @optional + stdDeviation: string, + @optional + stemh: string, + @optional + stemv: string, + @optional + stitchTiles: string, + @optional + stopColor: string, + @optional + stopOpacity: string, + @optional + strikethroughPosition: string, + @optional + strikethroughThickness: string, + @optional + string: string, + @optional + stroke: string, + @optional + strokeDasharray: string, + @optional + strokeDashoffset: string, + @optional + strokeLinecap: string, + @optional + strokeLinejoin: string, + @optional + strokeMiterlimit: string, + @optional + strokeOpacity: string, + @optional + strokeWidth: string, + @optional + surfaceScale: string, + @optional + systemLanguage: string, + @optional + tableValues: string, + @optional + targetX: string, + @optional + targetY: string, + @optional + textAnchor: string, + @optional + textDecoration: string, + @optional + textLength: string, + @optional + textRendering: string, + @optional @as("to") + to_: string /* use this one. Previous one is deprecated */, + @optional + transform: string, + @optional + u1: string, + @optional + u2: string, + @optional + underlinePosition: string, + @optional + underlineThickness: string, + @optional + unicode: string, + @optional + unicodeBidi: string, + @optional + unicodeRange: string, + @optional + unitsPerEm: string, + @optional + vAlphabetic: string, + @optional + vHanging: string, + @optional + vIdeographic: string, + @optional + vMathematical: string, + @optional + values: string, + @optional + vectorEffect: string, + @optional + version: string, + @optional + vertAdvX: string, + @optional + vertAdvY: string, + @optional + vertOriginX: string, + @optional + vertOriginY: string, + @optional + viewBox: string, + @optional + viewTarget: string, + @optional + visibility: string, + /* width::string? => */ + @optional + widths: string, + @optional + wordSpacing: string, + @optional + writingMode: string, + @optional + x: string, + @optional + x1: string, + @optional + x2: string, + @optional + xChannelSelector: string, + @optional + xHeight: string, + @optional + xlinkActuate: string, + @optional + xlinkArcrole: string, + @optional + xlinkHref: string, + @optional + xlinkRole: string, + @optional + xlinkShow: string, + @optional + xlinkTitle: string, + @optional + xlinkType: string, + @optional + xmlns: string, + @optional + xmlnsXlink: string, + @optional + xmlBase: string, + @optional + xmlLang: string, + @optional + xmlSpace: string, + @optional + y: string, + @optional + y1: string, + @optional + y2: string, + @optional + yChannelSelector: string, + @optional + z: string, + @optional + zoomAndPan: string, + /* RDFa */ + @optional + about: string, + @optional + datatype: string, + @optional + inlist: string, + @optional + prefix: string, + @optional + property: string, + @optional + resource: string, + @optional + typeof: string, + @optional + vocab: string, + /* react-specific */ + @optional + dangerouslySetInnerHTML: {"__html": string}, + @optional + suppressContentEditableWarning: bool, +*) + let mkLabel_ name typString = + mkItem ~name ~kind:4 ~deprecated:None ~detail:typString ~docstring:[] + in + let mkLabel (name, typ) = mkLabel_ name typ in + let keyLabel = mkLabel_ "key" "string" in + if labels = [] then [] + else + (labels + |> List.filter (fun (name, _t) -> + Utils.startsWith name prefix && not (List.mem name identsSeen)) + |> List.map mkLabel) + @ [keyLabel] | Cjsx (componentPath, prefix, identsSeen) -> let items = findItems ~exact:true (componentPath @ ["make"]) in let labels = @@ -469,11 +1493,11 @@ let processCompletable ~findItems ~package ~rawOpens let keyLabel = mkLabel_ "key" "string" in if labels = [] then [] else - keyLabel - :: (labels - |> List.filter (fun (name, _t) -> - Utils.startsWith name prefix && not (List.mem name identsSeen)) - |> List.map mkLabel) + (labels + |> List.filter (fun (name, _t) -> + Utils.startsWith name prefix && not (List.mem name identsSeen)) + |> List.map mkLabel) + @ [keyLabel] | Cpath parts -> let items = parts |> findItems ~exact:false in (* TODO(#107): figure out why we're getting duplicates. *) diff --git a/analysis/src/PartialParser.ml b/analysis/src/PartialParser.ml index 11602e1f0..a0fbd6839 100644 --- a/analysis/src/PartialParser.ml +++ b/analysis/src/PartialParser.ml @@ -128,7 +128,7 @@ let findJsxContext text offset = let ident = String.sub text i1 (i - i1 + 1) in if i1 >= 1 && ident <> "" then match ident.[0] with - | 'A' .. 'Z' when i1 >= 1 && text.[i1 - 1] = '<' -> + | ('a' .. 'z' | 'A' .. 'Z') when i1 >= 1 && text.[i1 - 1] = '<' -> Some (ident, identsSeen) | _ -> beforeIdent identsSeen (i1 - 1) else None diff --git a/analysis/tests/src/Div.res b/analysis/tests/src/Div.res index 919fb1d79..540f95af7 100644 --- a/analysis/tests/src/Div.res +++ b/analysis/tests/src/Div.res @@ -1,3 +1,5 @@ let q =
-// ^hov \ No newline at end of file +// ^hov + +// ^com
", "documentation": null }, { - "label": "zoo", + "label": "key", "kind": 4, "tags": [], - "detail": "option", + "detail": "string", "documentation": null }] diff --git a/analysis/tests/src/expected/Div.res.txt b/analysis/tests/src/expected/Div.res.txt index 0c58456a0..398fdbb0c 100644 --- a/analysis/tests/src/expected/Div.res.txt +++ b/analysis/tests/src/expected/Div.res.txt @@ -1,3 +1,24 @@ Hover tests/src/Div.res 1:10 {"contents": "```rescript\n(\n string,\n ~?props: ReactDOMRe.domProps,\n array,\n) => React.element\n```"} +Complete tests/src/Div.res 3:3 +[{ + "label": "aria-details", + "kind": 4, + "tags": [], + "detail": "string", + "documentation": null + }, { + "label": "aria-disabled", + "kind": 4, + "tags": [], + "detail": "bool", + "documentation": null + }, { + "label": "key", + "kind": 4, + "tags": [], + "detail": "string", + "documentation": null + }] + diff --git a/analysis/tests/src/expected/Jsx.res.txt b/analysis/tests/src/expected/Jsx.res.txt index 5bc6cd223..c1e03a8ec 100644 --- a/analysis/tests/src/expected/Jsx.res.txt +++ b/analysis/tests/src/expected/Jsx.res.txt @@ -3,12 +3,6 @@ Definition tests/src/Jsx.res 5:9 Complete tests/src/Jsx.res 7:2 [{ - "label": "key", - "kind": 4, - "tags": [], - "detail": "string", - "documentation": null - }, { "label": "first", "kind": 4, "tags": [], @@ -20,16 +14,16 @@ Complete tests/src/Jsx.res 7:2 "tags": [], "detail": "option", "documentation": null - }] - -Complete tests/src/Jsx.res 9:2 -[{ + }, { "label": "key", "kind": 4, "tags": [], "detail": "string", "documentation": null - }, { + }] + +Complete tests/src/Jsx.res 9:2 +[{ "label": "first", "kind": 4, "tags": [], @@ -41,16 +35,16 @@ Complete tests/src/Jsx.res 9:2 "tags": [], "detail": "option", "documentation": null - }] - -Complete tests/src/Jsx.res 11:2 -[{ + }, { "label": "key", "kind": 4, "tags": [], "detail": "string", "documentation": null - }, { + }] + +Complete tests/src/Jsx.res 11:2 +[{ "label": "second", "kind": 4, "tags": [], @@ -68,6 +62,12 @@ Complete tests/src/Jsx.res 11:2 "tags": [], "detail": "option", "documentation": null + }, { + "label": "key", + "kind": 4, + "tags": [], + "detail": "string", + "documentation": null }] Complete tests/src/Jsx.res 18:2 From 46f8edf4c97346fb27491aa6ff0294e9e4f8851a Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Thu, 6 May 2021 03:26:20 +0200 Subject: [PATCH 3/3] Add big array of dom props. --- analysis/src/NewCompletions.ml | 1455 +++++++---------------- analysis/tests/src/Div.res | 2 +- analysis/tests/src/expected/Div.res.txt | 10 +- 3 files changed, 447 insertions(+), 1020 deletions(-) diff --git a/analysis/src/NewCompletions.ml b/analysis/src/NewCompletions.ml index 9d6dc73bd..8c6814ceb 100644 --- a/analysis/src/NewCompletions.ml +++ b/analysis/src/NewCompletions.ml @@ -431,1017 +431,450 @@ let processCompletable ~findItems ~package ~rawOpens (completable : PartialParser.completable) = match completable with | Cjsx ([id], prefix, identsSeen) when String.lowercase_ascii id = id -> - let labels = [("aria-details", "string"); ("aria-disabled", "bool")] in - (* - @optional @as("aria-details") - ariaDetails: string, - @optional @as("aria-disabled") - ariaDisabled: bool, - @optional @as("aria-hidden") - ariaHidden: bool, - /* [@optional] [@as "aria-invalid"] ariaInvalid: grammar|false|spelling|true, */ - @optional @as("aria-keyshortcuts") - ariaKeyshortcuts: string, - @optional @as("aria-label") - ariaLabel: string, - @optional @as("aria-roledescription") - ariaRoledescription: string, - /* Widget Attributes */ - /* [@optional] [@as "aria-autocomplete"] ariaAutocomplete: inline|list|both|none, */ - /* [@optional] [@as "aria-checked"] ariaChecked: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */ - @optional @as("aria-expanded") - ariaExpanded: bool, - /* [@optional] [@as "aria-haspopup"] ariaHaspopup: false|true|menu|listbox|tree|grid|dialog, */ - @optional @as("aria-level") - ariaLevel: int, - @optional @as("aria-modal") - ariaModal: bool, - @optional @as("aria-multiline") - ariaMultiline: bool, - @optional @as("aria-multiselectable") - ariaMultiselectable: bool, - /* [@optional] [@as "aria-orientation"] ariaOrientation: horizontal|vertical|undefined, */ - @optional @as("aria-placeholder") - ariaPlaceholder: string, - /* [@optional] [@as "aria-pressed"] ariaPressed: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */ - @optional @as("aria-readonly") - ariaReadonly: bool, - @optional @as("aria-required") - ariaRequired: bool, - @optional @as("aria-selected") - ariaSelected: bool, - @optional @as("aria-sort") - ariaSort: string, - @optional @as("aria-valuemax") - ariaValuemax: float, - @optional @as("aria-valuemin") - ariaValuemin: float, - @optional @as("aria-valuenow") - ariaValuenow: float, - @optional @as("aria-valuetext") - ariaValuetext: string, - /* Live Region Attributes */ - @optional @as("aria-atomic") - ariaAtomic: bool, - @optional @as("aria-busy") - ariaBusy: bool, - /* [@optional] [@as "aria-live"] ariaLive: off|polite|assertive|rude, */ - @optional @as("aria-relevant") - ariaRelevant: string, - /* Drag-and-Drop Attributes */ - /* [@optional] [@as "aria-dropeffect"] ariaDropeffect: copy|move|link|execute|popup|none, */ - @optional @as("aria-grabbed") - ariaGrabbed: bool, - /* Relationship Attributes */ - @optional @as("aria-activedescendant") - ariaActivedescendant: string, - @optional @as("aria-colcount") - ariaColcount: int, - @optional @as("aria-colindex") - ariaColindex: int, - @optional @as("aria-colspan") - ariaColspan: int, - @optional @as("aria-controls") - ariaControls: string, - @optional @as("aria-describedby") - ariaDescribedby: string, - @optional @as("aria-errormessage") - ariaErrormessage: string, - @optional @as("aria-flowto") - ariaFlowto: string, - @optional @as("aria-labelledby") - ariaLabelledby: string, - @optional @as("aria-owns") - ariaOwns: string, - @optional @as("aria-posinset") - ariaPosinset: int, - @optional @as("aria-rowcount") - ariaRowcount: int, - @optional @as("aria-rowindex") - ariaRowindex: int, - @optional @as("aria-rowspan") - ariaRowspan: int, - @optional @as("aria-setsize") - ariaSetsize: int, - /* react textarea/input */ - @optional - defaultChecked: bool, - @optional - defaultValue: string, - /* global html attributes */ - @optional - accessKey: string, - @optional - className: string /* substitute for "class" */, - @optional - contentEditable: bool, - @optional - contextMenu: string, - @optional - dir: string /* "ltr", "rtl" or "auto" */, - @optional - draggable: bool, - @optional - hidden: bool, - @optional - id: string, - @optional - lang: string, - @optional - role: string /* ARIA role */, - @optional - style: style, - @optional - spellCheck: bool, - @optional - tabIndex: int, - @optional - title: string, - /* html5 microdata */ - @optional - itemID: string, - @optional - itemProp: string, - @optional - itemRef: string, - @optional - itemScope: bool, - @optional - itemType: string /* uri */, - /* tag-specific html attributes */ - @optional - accept: string, - @optional - acceptCharset: string, - @optional - action: string /* uri */, - @optional - allowFullScreen: bool, - @optional - alt: string, - @optional - async: bool, - @optional - autoComplete: string /* has a fixed, but large-ish, set of possible values */, - @optional - autoCapitalize: string /* Mobile Safari specific */, - @optional - autoFocus: bool, - @optional - autoPlay: bool, - @optional - challenge: string, - @optional - charSet: string, - @optional - checked: bool, - @optional - cite: string /* uri */, - @optional - crossOrigin: string /* anonymous, use-credentials */, - @optional - cols: int, - @optional - colSpan: int, - @optional - content: string, - @optional - controls: bool, - @optional - coords: string /* set of values specifying the coordinates of a region */, - @optional - data: string /* uri */, - @optional - dateTime: string /* "valid date string with optional time" */, - @optional - default: bool, - @optional - defer: bool, - @optional - disabled: bool, - @optional - download: string /* should really be either a boolean, signifying presence, or a string */, - @optional - encType: string /* "application/x-www-form-urlencoded", "multipart/form-data" or "text/plain" */, - @optional - form: string, - @optional - formAction: string /* uri */, - @optional - formTarget: string /* "_blank", "_self", etc. */, - @optional - formMethod: string /* "post", "get", "put" */, - @optional - headers: string, - @optional - height: string /* in html5 this can only be a number, but in html4 it can ba a percentage as well */, - @optional - high: int, - @optional - href: string /* uri */, - @optional - hrefLang: string, - @optional - htmlFor: string /* substitute for "for" */, - @optional - httpEquiv: string /* has a fixed set of possible values */, - @optional - icon: string /* uri? */, - @optional - inputMode: string /* "verbatim", "latin", "numeric", etc. */, - @optional - integrity: string, - @optional - keyType: string, - @optional - kind: string /* has a fixed set of possible values */, - @optional - label: string, - @optional - list: string, - @optional - loop: bool, - @optional - low: int, - @optional - manifest: string /* uri */, - @optional - max: string /* should be int or Js.Date.t */, - @optional - maxLength: int, - @optional - media: string /* a valid media query */, - @optional - mediaGroup: string, - @optional - method: string /* "post" or "get" */, - @optional - min: string, - @optional - minLength: int, - @optional - multiple: bool, - @optional - muted: bool, - @optional - name: string, - @optional - nonce: string, - @optional - noValidate: bool, - @optional @as("open") - open_: bool /* use this one. Previous one is deprecated */, - @optional - optimum: int, - @optional - pattern: string /* valid Js RegExp */, - @optional - placeholder: string, - @optional - playsInline: bool, - @optional - poster: string /* uri */, - @optional - preload: string /* "none", "metadata" or "auto" (and "" as a synonym for "auto") */, - @optional - radioGroup: string, - @optional - readOnly: bool, - @optional - rel: string /* a space- or comma-separated (depending on the element) list of a fixed set of "link types" */, - @optional - required: bool, - @optional - reversed: bool, - @optional - rows: int, - @optional - rowSpan: int, - @optional - sandbox: string /* has a fixed set of possible values */, - @optional - scope: string /* has a fixed set of possible values */, - @optional - scoped: bool, - @optional - scrolling: string /* html4 only, "auto", "yes" or "no" */, - /* seamless - supported by React, but removed from the html5 spec */ - @optional - selected: bool, - @optional - shape: string, - @optional - size: int, - @optional - sizes: string, - @optional - span: int, - @optional - src: string /* uri */, - @optional - srcDoc: string, - @optional - srcLang: string, - @optional - srcSet: string, - @optional - start: int, - @optional - step: float, - @optional - summary: string /* deprecated */, - @optional - target: string, - @optional @as("type") - type_: string /* has a fixed but large-ish set of possible values */ /* use this one. Previous one is deprecated */, - @optional - useMap: string, - @optional - value: string, - @optional - width: string /* in html5 this can only be a number, but in html4 it can ba a percentage as well */, - @optional - wrap: string /* "hard" or "soft" */, - /* Clipboard events */ - @optional - onCopy: ReactEvent.Clipboard.t => unit, - @optional - onCut: ReactEvent.Clipboard.t => unit, - @optional - onPaste: ReactEvent.Clipboard.t => unit, - /* Composition events */ - @optional - onCompositionEnd: ReactEvent.Composition.t => unit, - @optional - onCompositionStart: ReactEvent.Composition.t => unit, - @optional - onCompositionUpdate: ReactEvent.Composition.t => unit, - /* Keyboard events */ - @optional - onKeyDown: ReactEvent.Keyboard.t => unit, - @optional - onKeyPress: ReactEvent.Keyboard.t => unit, - @optional - onKeyUp: ReactEvent.Keyboard.t => unit, - /* Focus events */ - @optional - onFocus: ReactEvent.Focus.t => unit, - @optional - onBlur: ReactEvent.Focus.t => unit, - /* Form events */ - @optional - onChange: ReactEvent.Form.t => unit, - @optional - onInput: ReactEvent.Form.t => unit, - @optional - onSubmit: ReactEvent.Form.t => unit, - @optional - onInvalid: ReactEvent.Form.t => unit, - /* Mouse events */ - @optional - onClick: ReactEvent.Mouse.t => unit, - @optional - onContextMenu: ReactEvent.Mouse.t => unit, - @optional - onDoubleClick: ReactEvent.Mouse.t => unit, - @optional - onDrag: ReactEvent.Mouse.t => unit, - @optional - onDragEnd: ReactEvent.Mouse.t => unit, - @optional - onDragEnter: ReactEvent.Mouse.t => unit, - @optional - onDragExit: ReactEvent.Mouse.t => unit, - @optional - onDragLeave: ReactEvent.Mouse.t => unit, - @optional - onDragOver: ReactEvent.Mouse.t => unit, - @optional - onDragStart: ReactEvent.Mouse.t => unit, - @optional - onDrop: ReactEvent.Mouse.t => unit, - @optional - onMouseDown: ReactEvent.Mouse.t => unit, - @optional - onMouseEnter: ReactEvent.Mouse.t => unit, - @optional - onMouseLeave: ReactEvent.Mouse.t => unit, - @optional - onMouseMove: ReactEvent.Mouse.t => unit, - @optional - onMouseOut: ReactEvent.Mouse.t => unit, - @optional - onMouseOver: ReactEvent.Mouse.t => unit, - @optional - onMouseUp: ReactEvent.Mouse.t => unit, - /* Selection events */ - @optional - onSelect: ReactEvent.Selection.t => unit, - /* Touch events */ - @optional - onTouchCancel: ReactEvent.Touch.t => unit, - @optional - onTouchEnd: ReactEvent.Touch.t => unit, - @optional - onTouchMove: ReactEvent.Touch.t => unit, - @optional - onTouchStart: ReactEvent.Touch.t => unit, - // Pointer events - @optional - onPointerOver: ReactEvent.Pointer.t => unit, - @optional - onPointerEnter: ReactEvent.Pointer.t => unit, - @optional - onPointerDown: ReactEvent.Pointer.t => unit, - @optional - onPointerMove: ReactEvent.Pointer.t => unit, - @optional - onPointerUp: ReactEvent.Pointer.t => unit, - @optional - onPointerCancel: ReactEvent.Pointer.t => unit, - @optional - onPointerOut: ReactEvent.Pointer.t => unit, - @optional - onPointerLeave: ReactEvent.Pointer.t => unit, - @optional - onGotPointerCapture: ReactEvent.Pointer.t => unit, - @optional - onLostPointerCapture: ReactEvent.Pointer.t => unit, - /* UI events */ - @optional - onScroll: ReactEvent.UI.t => unit, - /* Wheel events */ - @optional - onWheel: ReactEvent.Wheel.t => unit, - /* Media events */ - @optional - onAbort: ReactEvent.Media.t => unit, - @optional - onCanPlay: ReactEvent.Media.t => unit, - @optional - onCanPlayThrough: ReactEvent.Media.t => unit, - @optional - onDurationChange: ReactEvent.Media.t => unit, - @optional - onEmptied: ReactEvent.Media.t => unit, - @optional - onEncrypetd: ReactEvent.Media.t => unit, - @optional - onEnded: ReactEvent.Media.t => unit, - @optional - onError: ReactEvent.Media.t => unit, - @optional - onLoadedData: ReactEvent.Media.t => unit, - @optional - onLoadedMetadata: ReactEvent.Media.t => unit, - @optional - onLoadStart: ReactEvent.Media.t => unit, - @optional - onPause: ReactEvent.Media.t => unit, - @optional - onPlay: ReactEvent.Media.t => unit, - @optional - onPlaying: ReactEvent.Media.t => unit, - @optional - onProgress: ReactEvent.Media.t => unit, - @optional - onRateChange: ReactEvent.Media.t => unit, - @optional - onSeeked: ReactEvent.Media.t => unit, - @optional - onSeeking: ReactEvent.Media.t => unit, - @optional - onStalled: ReactEvent.Media.t => unit, - @optional - onSuspend: ReactEvent.Media.t => unit, - @optional - onTimeUpdate: ReactEvent.Media.t => unit, - @optional - onVolumeChange: ReactEvent.Media.t => unit, - @optional - onWaiting: ReactEvent.Media.t => unit, - /* Image events */ - @optional - onLoad: ReactEvent.Image.t => unit /* duplicate */ /* ~onError: ReactEvent.Image.t => unit=?, */, - /* Animation events */ - @optional - onAnimationStart: ReactEvent.Animation.t => unit, - @optional - onAnimationEnd: ReactEvent.Animation.t => unit, - @optional - onAnimationIteration: ReactEvent.Animation.t => unit, - /* Transition events */ - @optional - onTransitionEnd: ReactEvent.Transition.t => unit, - /* svg */ - @optional - accentHeight: string, - @optional - accumulate: string, - @optional - additive: string, - @optional - alignmentBaseline: string, - @optional - allowReorder: string, - @optional - alphabetic: string, - @optional - amplitude: string, - @optional - arabicForm: string, - @optional - ascent: string, - @optional - attributeName: string, - @optional - attributeType: string, - @optional - autoReverse: string, - @optional - azimuth: string, - @optional - baseFrequency: string, - @optional - baseProfile: string, - @optional - baselineShift: string, - @optional - bbox: string, - @optional @as("begin") - begin_: string /* use this one. Previous one is deprecated */, - @optional - bias: string, - @optional - by: string, - @optional - calcMode: string, - @optional - capHeight: string, - @optional - clip: string, - @optional - clipPath: string, - @optional - clipPathUnits: string, - @optional - clipRule: string, - @optional - colorInterpolation: string, - @optional - colorInterpolationFilters: string, - @optional - colorProfile: string, - @optional - colorRendering: string, - @optional - contentScriptType: string, - @optional - contentStyleType: string, - @optional - cursor: string, - @optional - cx: string, - @optional - cy: string, - @optional - d: string, - @optional - decelerate: string, - @optional - descent: string, - @optional - diffuseConstant: string, - @optional - direction: string, - @optional - display: string, - @optional - divisor: string, - @optional - dominantBaseline: string, - @optional - dur: string, - @optional - dx: string, - @optional - dy: string, - @optional - edgeMode: string, - @optional - elevation: string, - @optional - enableBackground: string, - @optional @as("end") - end_: string /* use this one. Previous one is deprecated */, - @optional - exponent: string, - @optional - externalResourcesRequired: string, - @optional - fill: string, - @optional - fillOpacity: string, - @optional - fillRule: string, - @optional - filter: string, - @optional - filterRes: string, - @optional - filterUnits: string, - @optional - floodColor: string, - @optional - floodOpacity: string, - @optional - focusable: string, - @optional - fontFamily: string, - @optional - fontSize: string, - @optional - fontSizeAdjust: string, - @optional - fontStretch: string, - @optional - fontStyle: string, - @optional - fontVariant: string, - @optional - fontWeight: string, - @optional - fomat: string, - @optional - from: string, - @optional - fx: string, - @optional - fy: string, - @optional - g1: string, - @optional - g2: string, - @optional - glyphName: string, - @optional - glyphOrientationHorizontal: string, - @optional - glyphOrientationVertical: string, - @optional - glyphRef: string, - @optional - gradientTransform: string, - @optional - gradientUnits: string, - @optional - hanging: string, - @optional - horizAdvX: string, - @optional - horizOriginX: string, - @optional - ideographic: string, - @optional - imageRendering: string, - @optional @as("in") - in_: string /* use this one. Previous one is deprecated */, - @optional - in2: string, - @optional - intercept: string, - @optional - k: string, - @optional - k1: string, - @optional - k2: string, - @optional - k3: string, - @optional - k4: string, - @optional - kernelMatrix: string, - @optional - kernelUnitLength: string, - @optional - kerning: string, - @optional - keyPoints: string, - @optional - keySplines: string, - @optional - keyTimes: string, - @optional - lengthAdjust: string, - @optional - letterSpacing: string, - @optional - lightingColor: string, - @optional - limitingConeAngle: string, - @optional - local: string, - @optional - markerEnd: string, - @optional - markerHeight: string, - @optional - markerMid: string, - @optional - markerStart: string, - @optional - markerUnits: string, - @optional - markerWidth: string, - @optional - mask: string, - @optional - maskContentUnits: string, - @optional - maskUnits: string, - @optional - mathematical: string, - @optional - mode: string, - @optional - numOctaves: string, - @optional - offset: string, - @optional - opacity: string, - @optional - operator: string, - @optional - order: string, - @optional - orient: string, - @optional - orientation: string, - @optional - origin: string, - @optional - overflow: string, - @optional - overflowX: string, - @optional - overflowY: string, - @optional - overlinePosition: string, - @optional - overlineThickness: string, - @optional - paintOrder: string, - @optional - panose1: string, - @optional - pathLength: string, - @optional - patternContentUnits: string, - @optional - patternTransform: string, - @optional - patternUnits: string, - @optional - pointerEvents: string, - @optional - points: string, - @optional - pointsAtX: string, - @optional - pointsAtY: string, - @optional - pointsAtZ: string, - @optional - preserveAlpha: string, - @optional - preserveAspectRatio: string, - @optional - primitiveUnits: string, - @optional - r: string, - @optional - radius: string, - @optional - refX: string, - @optional - refY: string, - @optional - renderingIntent: string, - @optional - repeatCount: string, - @optional - repeatDur: string, - @optional - requiredExtensions: string, - @optional - requiredFeatures: string, - @optional - restart: string, - @optional - result: string, - @optional - rotate: string, - @optional - rx: string, - @optional - ry: string, - @optional - scale: string, - @optional - seed: string, - @optional - shapeRendering: string, - @optional - slope: string, - @optional - spacing: string, - @optional - specularConstant: string, - @optional - specularExponent: string, - @optional - speed: string, - @optional - spreadMethod: string, - @optional - startOffset: string, - @optional - stdDeviation: string, - @optional - stemh: string, - @optional - stemv: string, - @optional - stitchTiles: string, - @optional - stopColor: string, - @optional - stopOpacity: string, - @optional - strikethroughPosition: string, - @optional - strikethroughThickness: string, - @optional - string: string, - @optional - stroke: string, - @optional - strokeDasharray: string, - @optional - strokeDashoffset: string, - @optional - strokeLinecap: string, - @optional - strokeLinejoin: string, - @optional - strokeMiterlimit: string, - @optional - strokeOpacity: string, - @optional - strokeWidth: string, - @optional - surfaceScale: string, - @optional - systemLanguage: string, - @optional - tableValues: string, - @optional - targetX: string, - @optional - targetY: string, - @optional - textAnchor: string, - @optional - textDecoration: string, - @optional - textLength: string, - @optional - textRendering: string, - @optional @as("to") - to_: string /* use this one. Previous one is deprecated */, - @optional - transform: string, - @optional - u1: string, - @optional - u2: string, - @optional - underlinePosition: string, - @optional - underlineThickness: string, - @optional - unicode: string, - @optional - unicodeBidi: string, - @optional - unicodeRange: string, - @optional - unitsPerEm: string, - @optional - vAlphabetic: string, - @optional - vHanging: string, - @optional - vIdeographic: string, - @optional - vMathematical: string, - @optional - values: string, - @optional - vectorEffect: string, - @optional - version: string, - @optional - vertAdvX: string, - @optional - vertAdvY: string, - @optional - vertOriginX: string, - @optional - vertOriginY: string, - @optional - viewBox: string, - @optional - viewTarget: string, - @optional - visibility: string, - /* width::string? => */ - @optional - widths: string, - @optional - wordSpacing: string, - @optional - writingMode: string, - @optional - x: string, - @optional - x1: string, - @optional - x2: string, - @optional - xChannelSelector: string, - @optional - xHeight: string, - @optional - xlinkActuate: string, - @optional - xlinkArcrole: string, - @optional - xlinkHref: string, - @optional - xlinkRole: string, - @optional - xlinkShow: string, - @optional - xlinkTitle: string, - @optional - xlinkType: string, - @optional - xmlns: string, - @optional - xmlnsXlink: string, - @optional - xmlBase: string, - @optional - xmlLang: string, - @optional - xmlSpace: string, - @optional - y: string, - @optional - y1: string, - @optional - y2: string, - @optional - yChannelSelector: string, - @optional - z: string, - @optional - zoomAndPan: string, - /* RDFa */ - @optional - about: string, - @optional - datatype: string, - @optional - inlist: string, - @optional - prefix: string, - @optional - property: string, - @optional - resource: string, - @optional - typeof: string, - @optional - vocab: string, - /* react-specific */ - @optional - dangerouslySetInnerHTML: {"__html": string}, - @optional - suppressContentEditableWarning: bool, -*) + let labels = + [ + ("ariaDetails", "string"); + ("ariaDisabled", "bool"); + ("ariaHidden", "bool"); + ("ariaKeyshortcuts", "string"); + ("ariaLabel", "string"); + ("ariaRoledescription", "string"); + ("ariaExpanded", "bool"); + ("ariaLevel", "int"); + ("ariaModal", "bool"); + ("ariaMultiline", "bool"); + ("ariaMultiselectable", "bool"); + ("ariaPlaceholder", "string"); + ("ariaReadonly", "bool"); + ("ariaRequired", "bool"); + ("ariaSelected", "bool"); + ("ariaSort", "string"); + ("ariaValuemax", "float"); + ("ariaValuemin", "float"); + ("ariaValuenow", "float"); + ("ariaValuetext", "string"); + ("ariaAtomic", "bool"); + ("ariaBusy", "bool"); + ("ariaRelevant", "string"); + ("ariaGrabbed", "bool"); + ("ariaActivedescendant", "string"); + ("ariaColcount", "int"); + ("ariaColindex", "int"); + ("ariaColspan", "int"); + ("ariaControls", "string"); + ("ariaDescribedby", "string"); + ("ariaErrormessage", "string"); + ("ariaFlowto", "string"); + ("ariaLabelledby", "string"); + ("ariaOwns", "string"); + ("ariaPosinset", "int"); + ("ariaRowcount", "int"); + ("ariaRowindex", "int"); + ("ariaRowspan", "int"); + ("ariaSetsize", "int"); + ("defaultChecked", "bool"); + ("defaultValue", "string"); + ("accessKey", "string"); + ("contentEditable", "bool"); + ("contextMenu", "string"); + ("draggable", "bool"); + ("hidden", "bool"); + ("id", "string"); + ("lang", "string"); + ("style", "style"); + ("spellCheck", "bool"); + ("tabIndex", "int"); + ("title", "string"); + ("itemID", "string"); + ("itemProp", "string"); + ("itemRef", "string"); + ("itemScope", "bool"); + ("accept", "string"); + ("acceptCharset", "string"); + ("allowFullScreen", "bool"); + ("alt", "string"); + ("async", "bool"); + ("autoFocus", "bool"); + ("autoPlay", "bool"); + ("challenge", "string"); + ("charSet", "string"); + ("checked", "bool"); + ("cols", "int"); + ("colSpan", "int"); + ("content", "string"); + ("controls", "bool"); + ("default", "bool"); + ("defer", "bool"); + ("disabled", "bool"); + ("form", "string"); + ("headers", "string"); + ("high", "int"); + ("hrefLang", "string"); + ("integrity", "string"); + ("keyType", "string"); + ("label", "string"); + ("list", "string"); + ("loop", "bool"); + ("low", "int"); + ("maxLength", "int"); + ("mediaGroup", "string"); + ("min", "string"); + ("minLength", "int"); + ("multiple", "bool"); + ("muted", "bool"); + ("name", "string"); + ("nonce", "string"); + ("noValidate", "bool"); + ("optimum", "int"); + ("placeholder", "string"); + ("playsInline", "bool"); + ("radioGroup", "string"); + ("readOnly", "bool"); + ("required", "bool"); + ("reversed", "bool"); + ("rows", "int"); + ("rowSpan", "int"); + ("scoped", "bool"); + ("selected", "bool"); + ("shape", "string"); + ("size", "int"); + ("sizes", "string"); + ("span", "int"); + ("srcDoc", "string"); + ("srcLang", "string"); + ("srcSet", "string"); + ("start", "int"); + ("step", "float"); + ("target", "string"); + ("useMap", "string"); + ("value", "string"); + ("onCopy", "ReactEvent.Clipboard.t => unit"); + ("onCut", "ReactEvent.Clipboard.t => unit"); + ("onPaste", "ReactEvent.Clipboard.t => unit"); + ("onCompositionEnd", "ReactEvent.Composition.t => unit"); + ("onCompositionStart", "ReactEvent.Composition.t => unit"); + ("onCompositionUpdate", "ReactEvent.Composition.t => unit"); + ("onKeyDown", "ReactEvent.Keyboard.t => unit"); + ("onKeyPress", "ReactEvent.Keyboard.t => unit"); + ("onKeyUp", "ReactEvent.Keyboard.t => unit"); + ("onFocus", "ReactEvent.Focus.t => unit"); + ("onBlur", "ReactEvent.Focus.t => unit"); + ("onChange", "ReactEvent.Form.t => unit"); + ("onInput", "ReactEvent.Form.t => unit"); + ("onSubmit", "ReactEvent.Form.t => unit"); + ("onInvalid", "ReactEvent.Form.t => unit"); + ("onClick", "ReactEvent.Mouse.t => unit"); + ("onContextMenu", "ReactEvent.Mouse.t => unit"); + ("onDoubleClick", "ReactEvent.Mouse.t => unit"); + ("onDrag", "ReactEvent.Mouse.t => unit"); + ("onDragEnd", "ReactEvent.Mouse.t => unit"); + ("onDragEnter", "ReactEvent.Mouse.t => unit"); + ("onDragExit", "ReactEvent.Mouse.t => unit"); + ("onDragLeave", "ReactEvent.Mouse.t => unit"); + ("onDragOver", "ReactEvent.Mouse.t => unit"); + ("onDragStart", "ReactEvent.Mouse.t => unit"); + ("onDrop", "ReactEvent.Mouse.t => unit"); + ("onMouseDown", "ReactEvent.Mouse.t => unit"); + ("onMouseEnter", "ReactEvent.Mouse.t => unit"); + ("onMouseLeave", "ReactEvent.Mouse.t => unit"); + ("onMouseMove", "ReactEvent.Mouse.t => unit"); + ("onMouseOut", "ReactEvent.Mouse.t => unit"); + ("onMouseOver", "ReactEvent.Mouse.t => unit"); + ("onMouseUp", "ReactEvent.Mouse.t => unit"); + ("onSelect", "ReactEvent.Selection.t => unit"); + ("onTouchCancel", "ReactEvent.Touch.t => unit"); + ("onTouchEnd", "ReactEvent.Touch.t => unit"); + ("onTouchMove", "ReactEvent.Touch.t => unit"); + ("onTouchStart", "ReactEvent.Touch.t => unit"); + ("onPointerOver", "ReactEvent.Pointer.t => unit"); + ("onPointerEnter", "ReactEvent.Pointer.t => unit"); + ("onPointerDown", "ReactEvent.Pointer.t => unit"); + ("onPointerMove", "ReactEvent.Pointer.t => unit"); + ("onPointerUp", "ReactEvent.Pointer.t => unit"); + ("onPointerCancel", "ReactEvent.Pointer.t => unit"); + ("onPointerOut", "ReactEvent.Pointer.t => unit"); + ("onPointerLeave", "ReactEvent.Pointer.t => unit"); + ("onGotPointerCapture", "ReactEvent.Pointer.t => unit"); + ("onLostPointerCapture", "ReactEvent.Pointer.t => unit"); + ("onScroll", "ReactEvent.UI.t => unit"); + ("onWheel", "ReactEvent.Wheel.t => unit"); + ("onAbort", "ReactEvent.Media.t => unit"); + ("onCanPlay", "ReactEvent.Media.t => unit"); + ("onCanPlayThrough", "ReactEvent.Media.t => unit"); + ("onDurationChange", "ReactEvent.Media.t => unit"); + ("onEmptied", "ReactEvent.Media.t => unit"); + ("onEncrypetd", "ReactEvent.Media.t => unit"); + ("onEnded", "ReactEvent.Media.t => unit"); + ("onError", "ReactEvent.Media.t => unit"); + ("onLoadedData", "ReactEvent.Media.t => unit"); + ("onLoadedMetadata", "ReactEvent.Media.t => unit"); + ("onLoadStart", "ReactEvent.Media.t => unit"); + ("onPause", "ReactEvent.Media.t => unit"); + ("onPlay", "ReactEvent.Media.t => unit"); + ("onPlaying", "ReactEvent.Media.t => unit"); + ("onProgress", "ReactEvent.Media.t => unit"); + ("onRateChange", "ReactEvent.Media.t => unit"); + ("onSeeked", "ReactEvent.Media.t => unit"); + ("onSeeking", "ReactEvent.Media.t => unit"); + ("onStalled", "ReactEvent.Media.t => unit"); + ("onSuspend", "ReactEvent.Media.t => unit"); + ("onTimeUpdate", "ReactEvent.Media.t => unit"); + ("onVolumeChange", "ReactEvent.Media.t => unit"); + ("onWaiting", "ReactEvent.Media.t => unit"); + ("onAnimationStart", "ReactEvent.Animation.t => unit"); + ("onAnimationEnd", "ReactEvent.Animation.t => unit"); + ("onAnimationIteration", "ReactEvent.Animation.t => unit"); + ("onTransitionEnd", "ReactEvent.Transition.t => unit"); + ("accentHeight", "string"); + ("accumulate", "string"); + ("additive", "string"); + ("alignmentBaseline", "string"); + ("allowReorder", "string"); + ("alphabetic", "string"); + ("amplitude", "string"); + ("arabicForm", "string"); + ("ascent", "string"); + ("attributeName", "string"); + ("attributeType", "string"); + ("autoReverse", "string"); + ("azimuth", "string"); + ("baseFrequency", "string"); + ("baseProfile", "string"); + ("baselineShift", "string"); + ("bbox", "string"); + ("bias", "string"); + ("by", "string"); + ("calcMode", "string"); + ("capHeight", "string"); + ("clip", "string"); + ("clipPath", "string"); + ("clipPathUnits", "string"); + ("clipRule", "string"); + ("colorInterpolation", "string"); + ("colorInterpolationFilters", "string"); + ("colorProfile", "string"); + ("colorRendering", "string"); + ("contentScriptType", "string"); + ("contentStyleType", "string"); + ("cursor", "string"); + ("cx", "string"); + ("cy", "string"); + ("d", "string"); + ("decelerate", "string"); + ("descent", "string"); + ("diffuseConstant", "string"); + ("direction", "string"); + ("display", "string"); + ("divisor", "string"); + ("dominantBaseline", "string"); + ("dur", "string"); + ("dx", "string"); + ("dy", "string"); + ("edgeMode", "string"); + ("elevation", "string"); + ("enableBackground", "string"); + ("exponent", "string"); + ("externalResourcesRequired", "string"); + ("fill", "string"); + ("fillOpacity", "string"); + ("fillRule", "string"); + ("filter", "string"); + ("filterRes", "string"); + ("filterUnits", "string"); + ("floodColor", "string"); + ("floodOpacity", "string"); + ("focusable", "string"); + ("fontFamily", "string"); + ("fontSize", "string"); + ("fontSizeAdjust", "string"); + ("fontStretch", "string"); + ("fontStyle", "string"); + ("fontVariant", "string"); + ("fontWeight", "string"); + ("fomat", "string"); + ("from", "string"); + ("fx", "string"); + ("fy", "string"); + ("g1", "string"); + ("g2", "string"); + ("glyphName", "string"); + ("glyphOrientationHorizontal", "string"); + ("glyphOrientationVertical", "string"); + ("glyphRef", "string"); + ("gradientTransform", "string"); + ("gradientUnits", "string"); + ("hanging", "string"); + ("horizAdvX", "string"); + ("horizOriginX", "string"); + ("ideographic", "string"); + ("imageRendering", "string"); + ("in2", "string"); + ("intercept", "string"); + ("k", "string"); + ("k1", "string"); + ("k2", "string"); + ("k3", "string"); + ("k4", "string"); + ("kernelMatrix", "string"); + ("kernelUnitLength", "string"); + ("kerning", "string"); + ("keyPoints", "string"); + ("keySplines", "string"); + ("keyTimes", "string"); + ("lengthAdjust", "string"); + ("letterSpacing", "string"); + ("lightingColor", "string"); + ("limitingConeAngle", "string"); + ("local", "string"); + ("markerEnd", "string"); + ("markerHeight", "string"); + ("markerMid", "string"); + ("markerStart", "string"); + ("markerUnits", "string"); + ("markerWidth", "string"); + ("mask", "string"); + ("maskContentUnits", "string"); + ("maskUnits", "string"); + ("mathematical", "string"); + ("mode", "string"); + ("numOctaves", "string"); + ("offset", "string"); + ("opacity", "string"); + ("operator", "string"); + ("order", "string"); + ("orient", "string"); + ("orientation", "string"); + ("origin", "string"); + ("overflow", "string"); + ("overflowX", "string"); + ("overflowY", "string"); + ("overlinePosition", "string"); + ("overlineThickness", "string"); + ("paintOrder", "string"); + ("panose1", "string"); + ("pathLength", "string"); + ("patternContentUnits", "string"); + ("patternTransform", "string"); + ("patternUnits", "string"); + ("pointerEvents", "string"); + ("points", "string"); + ("pointsAtX", "string"); + ("pointsAtY", "string"); + ("pointsAtZ", "string"); + ("preserveAlpha", "string"); + ("preserveAspectRatio", "string"); + ("primitiveUnits", "string"); + ("r", "string"); + ("radius", "string"); + ("refX", "string"); + ("refY", "string"); + ("renderingIntent", "string"); + ("repeatCount", "string"); + ("repeatDur", "string"); + ("requiredExtensions", "string"); + ("requiredFeatures", "string"); + ("restart", "string"); + ("result", "string"); + ("rotate", "string"); + ("rx", "string"); + ("ry", "string"); + ("scale", "string"); + ("seed", "string"); + ("shapeRendering", "string"); + ("slope", "string"); + ("spacing", "string"); + ("specularConstant", "string"); + ("specularExponent", "string"); + ("speed", "string"); + ("spreadMethod", "string"); + ("startOffset", "string"); + ("stdDeviation", "string"); + ("stemh", "string"); + ("stemv", "string"); + ("stitchTiles", "string"); + ("stopColor", "string"); + ("stopOpacity", "string"); + ("strikethroughPosition", "string"); + ("strikethroughThickness", "string"); + ("string", "string"); + ("stroke", "string"); + ("strokeDasharray", "string"); + ("strokeDashoffset", "string"); + ("strokeLinecap", "string"); + ("strokeLinejoin", "string"); + ("strokeMiterlimit", "string"); + ("strokeOpacity", "string"); + ("strokeWidth", "string"); + ("surfaceScale", "string"); + ("systemLanguage", "string"); + ("tableValues", "string"); + ("targetX", "string"); + ("targetY", "string"); + ("textAnchor", "string"); + ("textDecoration", "string"); + ("textLength", "string"); + ("textRendering", "string"); + ("transform", "string"); + ("u1", "string"); + ("u2", "string"); + ("underlinePosition", "string"); + ("underlineThickness", "string"); + ("unicode", "string"); + ("unicodeBidi", "string"); + ("unicodeRange", "string"); + ("unitsPerEm", "string"); + ("vAlphabetic", "string"); + ("vHanging", "string"); + ("vIdeographic", "string"); + ("vMathematical", "string"); + ("values", "string"); + ("vectorEffect", "string"); + ("version", "string"); + ("vertAdvX", "string"); + ("vertAdvY", "string"); + ("vertOriginX", "string"); + ("vertOriginY", "string"); + ("viewBox", "string"); + ("viewTarget", "string"); + ("visibility", "string"); + ("widths", "string"); + ("wordSpacing", "string"); + ("writingMode", "string"); + ("x", "string"); + ("x1", "string"); + ("x2", "string"); + ("xChannelSelector", "string"); + ("xHeight", "string"); + ("xlinkActuate", "string"); + ("xlinkArcrole", "string"); + ("xlinkHref", "string"); + ("xlinkRole", "string"); + ("xlinkShow", "string"); + ("xlinkTitle", "string"); + ("xlinkType", "string"); + ("xmlns", "string"); + ("xmlnsXlink", "string"); + ("xmlBase", "string"); + ("xmlLang", "string"); + ("xmlSpace", "string"); + ("y", "string"); + ("y1", "string"); + ("y2", "string"); + ("yChannelSelector", "string"); + ("z", "string"); + ("zoomAndPan", "string"); + ("about", "string"); + ("datatype", "string"); + ("inlist", "string"); + ("prefix", "string"); + ("property", "string"); + ("resource", "string"); + ("typeof", "string"); + ("vocab", "string"); + ("dangerouslySetInnerHTML", "{\"__html\": string}"); + ("suppressContentEditableWarning", "bool"); + ] + in let mkLabel_ name typString = mkItem ~name ~kind:4 ~deprecated:None ~detail:typString ~docstring:[] in diff --git a/analysis/tests/src/Div.res b/analysis/tests/src/Div.res index 540f95af7..d9ccd7028 100644 --- a/analysis/tests/src/Div.res +++ b/analysis/tests/src/Div.res @@ -2,4 +2,4 @@ let q =
// ^hov -// ^com