Skip to content

Commit

Permalink
Better unused bind conflict message
Browse files Browse the repository at this point in the history
  • Loading branch information
amyjko committed Mar 2, 2024
1 parent 7238859 commit c6ff7d6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 5 additions & 2 deletions src/conflicts/UnusedBind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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),
),
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/locale/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion static/locales/es-MX/es-MX.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion static/locales/zh-CN/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@
"MissingShareLanguages": "如果你想要分享这个,你需要说明它是什么语言的,这样其他人才知道他们能不能阅读你分享的东西!",
"RequiredAfterOptional": "我不能在这,这里还有一个可选的 @Bind 在我前面",
"UnexpectedEtc": "只有在 @FunctionDefinition 中我才是可变的长度",
"UnusedBind": "嘿,我给这这个变量命名了,但是它还没有被使用呢!"
"UnusedBind": "$! 嘿,我给这这个变量命名了,但是它还没有被使用呢!"
}
},
"Block": {
Expand Down

0 comments on commit c6ff7d6

Please sign in to comment.