From 8382cc473a968334ecce4213622f4d1c58092972 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Thu, 10 Dec 2020 15:41:19 +0100 Subject: [PATCH] Fix issue where type variables are printed with global renaming when hovering or autocompleting a module Fixes https://github.com/rescript-lang/rescript-editor-support/issues/38. Turns out `Printtyp` keeps global state when converting to outcome printer data structures. Reses the data before converting types to strings. --- Changes.md | 1 + src/rescript-editor-support/PrintType.re | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Changes.md b/Changes.md index b108c637..36dfde53 100644 --- a/Changes.md +++ b/Changes.md @@ -1,4 +1,5 @@ ## master +- Fix issue where type variables are printed with global renaming when hovering or autocompleting a module (see https://github.com/rescript-lang/rescript-editor-support/issues/38). ## Release 1.0.1 of rescript-vscode This [commit](https://github.com/rescript-lang/rescript-editor-support/commit/232ad609766c415048750c5cc828973a9995f382) is vendored in [rescript-vscode 1.0.1](https://github.com/rescript-lang/rescript-vscode/releases/tag/1.0.1). diff --git a/src/rescript-editor-support/PrintType.re b/src/rescript-editor-support/PrintType.re index 9295088d..4f84adce 100644 --- a/src/rescript-editor-support/PrintType.re +++ b/src/rescript-editor-support/PrintType.re @@ -1,4 +1,5 @@ let printExpr = typ => { + Printtyp.reset_names(); Res_doc.toString( ~width=60, Res_outcome_printer.printOutTypeDoc(Printtyp.tree_of_typexp(false, typ)), @@ -6,6 +7,7 @@ let printExpr = typ => { }; let printDecl = (~recStatus, name, decl) => { + Printtyp.reset_names(); Res_doc.toString( ~width=60, Res_outcome_printer.printOutSigItemDoc(