diff --git a/CHANGELOG.md b/CHANGELOG.md index ae5e231c3..64f0f0ef8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Dates are in `YYYY-MM-DD` format and versions are in [semantic versioning](http: - Allow paste in `Chat` input box - Disabled automatic pretty printing. - Fixed list spread doc example. +- Better unused bind conflict message. ## 0.9.34 2024-02-24 diff --git a/src/conflicts/UnusedBind.ts b/src/conflicts/UnusedBind.ts index efcb99b0b..94e47f81c 100644 --- a/src/conflicts/UnusedBind.ts +++ b/src/conflicts/UnusedBind.ts @@ -2,6 +2,8 @@ import type Bind from '@nodes/Bind'; import Conflict from './Conflict'; import concretize from '../locale/concretize'; import type Locales from '../locale/Locales'; +import NodeRef from '@locale/NodeRef'; +import type Context from '@nodes/Context'; export default class UnusedBind extends Conflict { readonly bind: Bind; @@ -16,10 +18,11 @@ export default class UnusedBind extends Conflict { return { primary: { node: this.bind, - explanation: (locales: Locales) => + explanation: (locales: Locales, context: Context) => concretize( locales, - locales.get((l) => l.node.Bind.conflict.UnusedBind) + locales.get((l) => l.node.Bind.conflict.UnusedBind), + new NodeRef(this.bind.names, locales, context), ), }, }; diff --git a/src/locale/en-US.json b/src/locale/en-US.json index 211e6f2ac..112780a02 100644 --- a/src/locale/en-US.json +++ b/src/locale/en-US.json @@ -422,7 +422,7 @@ "MissingShareLanguages": "if you want to share this, you have to say what language this is in, so others know if they can read it!", "RequiredAfterOptional": "I can't be here, there's an optional @Bind before me", "UnexpectedEtc": "I can only be variable length in a @FunctionDefinition", - "UnusedBind": "hey, I named this value, but no one is using it!" + "UnusedBind": "I named $1, but no one is using it. Maybe it's not needed?" } }, "Block": { diff --git a/static/locales/es-MX/es-MX.json b/static/locales/es-MX/es-MX.json index 94d9d08a2..ca7f5aa18 100644 --- a/static/locales/es-MX/es-MX.json +++ b/static/locales/es-MX/es-MX.json @@ -402,7 +402,7 @@ "MissingShareLanguages": "si quieres compartir esto, debes decir en qué idioma está, para que los demás sepan si pueden leerlo!", "RequiredAfterOptional": "No puedo estar aquí, hay un @Bind opcional antes que yo", "UnexpectedEtc": "Solo puedo tener una longitud variable en un @FunctionDefinition", - "UnusedBind": "oye, le puse nombre a este valor, ¡pero nadie lo está usando!" + "UnusedBind": "$! oye, le puse nombre a este valor, ¡pero nadie lo está usando!" } }, "Block": { diff --git a/static/locales/zh-CN/zh-CN.json b/static/locales/zh-CN/zh-CN.json index 03ad9248d..a16efeb4c 100644 --- a/static/locales/zh-CN/zh-CN.json +++ b/static/locales/zh-CN/zh-CN.json @@ -423,7 +423,7 @@ "MissingShareLanguages": "如果你想要分享这个,你需要说明它是什么语言的,这样其他人才知道他们能不能阅读你分享的东西!", "RequiredAfterOptional": "我不能在这,这里还有一个可选的 @Bind 在我前面", "UnexpectedEtc": "只有在 @FunctionDefinition 中我才是可变的长度", - "UnusedBind": "嘿,我给这这个变量命名了,但是它还没有被使用呢!" + "UnusedBind": "$! 嘿,我给这这个变量命名了,但是它还没有被使用呢!" } }, "Block": {