Skip to content

Commit 075659f

Browse files
committed
Merge branch 'feature/langserver-rewrite-csharp'
2 parents f1eb936 + f9c1265 commit 075659f

18 files changed

Lines changed: 246 additions & 88 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ All notable changes to FScript are documented in this file.
1717
- Switched C# LSP host to full-method dispatch parity via shared handlers, made it the default test target, and updated extension/tag packaging to use `FScript.LanguageServer.dll`.
1818
- Replaced the F# LSP server executable with `FScript.LanguageServer` (C#) and moved F# LSP logic into `FScript.LanguageServer.Core`.
1919
- Fixed imported qualified type annotations (for example `common.ProjectInfo`) in parser/type inference to prevent false type mismatches.
20+
- Fixed LSP inlay hints to ignore spans from other files so included symbols no longer leak labels into unrelated declarations.
21+
- Enforced string-only map keys across type inference, evaluation, samples, and LSP type rendering (removed `int|string` key-domain displays).
22+
- Fixed map-pattern inlay hints to infer key/value/tail bindings (`string`, `int`, `int map`) instead of `unknown`.
2023

2124
## [0.33.0]
2225

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ FScript currently includes:
3030
- optional type annotations on parameters,
3131
- type declarations: records and unions (including recursive forms),
3232
- interpolation, pipeline operator, `typeof` type tokens, and `nameof` identifier tokens for host workflows.
33-
- unified brace literals for records/maps (`{ Field = value }`, `{ [key] = value }`, `{}` for empty map), with map keys typed as `string` or `int`.
33+
- unified brace literals for records/maps (`{ Field = value }`, `{ [key] = value }`, `{}` for empty map), with map keys typed as `string`.
3434

3535
## Getting Started Tutorial
3636

docs/guides/getting-started-tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,10 @@ let maybeMath = scores |> Map.tryGet "math"
165165
print $"{maybeMath}"
166166
```
167167

168-
Map keys can be `string` or `int`:
168+
Map keys are `string`:
169169

170170
```fsharp
171-
let status = { [200] = "ok"; [404] = "not-found" }
171+
let status = { ["200"] = "ok"; ["404"] = "not-found" }
172172
```
173173

174174
### Discriminated union

docs/guides/language-choices.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ let x =
2121
- `'a map`
2222
- Map values use native literals:
2323
- `{ ["a"] = 1; ["b"] = 2 }`
24-
- `{ [1] = "one"; [2] = "two" }`
2524
- Map update/merge is available directly in literals:
2625
- `{ ["a"] = 1; ..tail }`
2726
- Function types use arrow syntax:
@@ -56,7 +55,6 @@ let x =
5655
- Typed decoding workflows use `typeof Name` tokens with host externs.
5756
- Capability maps can use `nameof identifier` for stable script-side function keys.
5857
- Capability maps use string keys in map literals (`[expr]` where `expr : string`).
59-
- Maps also support integer keys (`[expr]` where `expr : int`) for numeric indexing scenarios.
6058

6159
## Formatting and layout choices
6260
- `match` case columns align.

docs/specs/lsp-inlay-hints.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,8 @@ match firstEven with
4848
Formatting follows LSP-friendly type rendering rules:
4949
- unknown inferred variable: `unknown`
5050
- map value type when key domain is unresolved: `unknown map`
51-
- map key-domain variable constrained by language map rules: `int|string`
5251

5352
Examples:
54-
- `: int|string`
5553
- `: unknown map`
5654

5755
## Configuration

docs/specs/map-matching-reference.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,7 @@ match values with
1212
| _ -> ""
1313
```
1414

15-
Keys can be `string` or `int`:
16-
17-
```fsharp
18-
match codes with
19-
| { [200] = label } -> label
20-
| _ -> "missing"
21-
```
15+
Keys must be `string`.
2216

2317
## Supported forms
2418

@@ -86,7 +80,6 @@ let describe values =
8680
- Map literals:
8781
- `{}` empty map
8882
- `{ ["k"] = v }`
89-
- `{ [1] = v }`
9083
- `{ ["k"] = v; ..tail }`
9184
- For map construction/update rules, see [`supported-types.md`](./supported-types.md).
9285
- For full syntax/layout rules, see [`syntax-and-indentation.md`](./syntax-and-indentation.md).

docs/specs/stdlib-functions.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The stdlib is loaded automatically by `FScript.Language` before user scripts.
5656
- `Map.iter : ('k -> 'v -> unit) -> map<'k, 'v> -> unit`
5757
- `Map.remove : 'k -> map<'k, 'v> -> map<'k, 'v>`
5858

59-
Map key support in FScript currently allows `string` and `int` keys.
59+
Map keys in FScript are string-only.
6060

6161
## Quick examples
6262
```fsharp
@@ -67,7 +67,6 @@ let maybePort = Some 8080
6767
let port = maybePort |> Option.defaultValue 80
6868
6969
let m = { ["a"] = 1; ["b"] = 2 }
70-
let n = { [1] = "one"; [2] = "two" }
7170
let hasA = Map.containsKey "a" m
72-
let one = n[1] |> Option.defaultValue "missing"
71+
let one = m["a"] |> Option.defaultValue 0
7372
```

docs/specs/supported-types.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ This document specifies the value and type system used by the interpreter.
2222
- Native map literal syntax:
2323
- empty: `{}`
2424
- populated: `{ ["a"] = 1; ["b"] = 2 }`
25-
- int keys: `{ [1] = "one"; [2] = "two" }`
2625
- spread update: `{ ["a"] = 1; ..tail }`
2726
- multiline entries are supported in an indented block.
28-
- Keys are bracketed expressions and must have type `string` or `int` (for example `{ [keyExpr] = value }`).
27+
- Keys are bracketed expressions and must have type `string` (for example `{ [keyExpr] = value }`).
2928
- Record literals and map literals share `{ ... }` braces:
3029
- map entries use `[expr] = value`
3130
- record entries use `Field = value`

docs/specs/syntax-and-indentation.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ This document describes the concrete syntax accepted by the interpreter and the
3838
- record patterns in cases: `{ Field = pattern; ... }`
3939
- map patterns in cases support keyed lookup and extraction:
4040
- keyed lookup: `{ ["key"] = v }`
41-
- int-key lookup: `{ [1] = v }`
4241
- multiple keys: `{ ["a"] = x; ["b"] = y }`
4342
- optional tail capture: `{ ["a"] = x; ..tail }`
4443
- dynamic extraction (preserved): `{ [k] = v; ..tail }`
@@ -58,12 +57,11 @@ This document describes the concrete syntax accepted by the interpreter and the
5857
- Maps:
5958
- empty `{}`
6059
- literal `{ ["a"] = 1; ["b"] = 2 }`
61-
- int-key literal `{ [1] = "one"; [2] = "two" }`
6260
- update/merge with spread `{ ["a"] = 1; ..tail }`
6361
- map entries always use bracketed keys (`[expr] = value`)
6462
- record entries use field assignments (`Field = value`)
6563
- when braces are empty (`{}`), the literal is a map
66-
- keys are bracketed expressions (`[expr]`) and must infer to `string` or `int`
64+
- keys are bracketed expressions (`[expr]`) and must infer to `string`
6765
- if entries start on the next line, `{` must be on its own line
6866
- multiline example:
6967
```fsharp

samples/map-matching.fss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ let values =
55
["gamma"] = 30 }
66

77
let indexed =
8-
{ [1] = "one"
9-
[2] = "two"
10-
[3] = "three" }
8+
{ ["1"] = "one"
9+
["2"] = "two"
10+
["3"] = "three" }
1111

1212
match values with
1313
| { ["alpha"] = v1; ..tail } ->
@@ -25,6 +25,6 @@ match values with
2525
| _ -> print "no dynamic match"
2626

2727
match indexed with
28-
| { [1] = first; [2] = second; ..tail } ->
29-
print $"int-key match: first={first}, second={second}, tail={tail}"
30-
| _ -> print "no int-key match"
28+
| { ["1"] = first; ["2"] = second; ..tail } ->
29+
print $"string-key match: first={first}, second={second}, tail={tail}"
30+
| _ -> print "no string-key match"

0 commit comments

Comments
 (0)