@typespec/prettier-plugin-typespec 0.49.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +11 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -694,6 +694,7 @@ const diagnostics = {
|
|
|
694
694
|
messages: {
|
|
695
695
|
default: "Cannot spread properties of non-model type.",
|
|
696
696
|
neverIndex: "Cannot spread type because it cannot hold properties.",
|
|
697
|
+
selfSpread: "Cannot spread type within its own declaration.",
|
|
697
698
|
},
|
|
698
699
|
},
|
|
699
700
|
"unsupported-default": {
|
|
@@ -5758,7 +5759,7 @@ function createParser(code, options = {}) {
|
|
|
5758
5759
|
item = parseScalarStatement(pos, decorators);
|
|
5759
5760
|
break;
|
|
5760
5761
|
case Token.NamespaceKeyword:
|
|
5761
|
-
item = parseNamespaceStatement(pos, decorators);
|
|
5762
|
+
item = parseNamespaceStatement(pos, decorators, docs);
|
|
5762
5763
|
break;
|
|
5763
5764
|
case Token.InterfaceKeyword:
|
|
5764
5765
|
item = parseInterfaceStatement(pos, decorators);
|
|
@@ -5799,7 +5800,9 @@ function createParser(code, options = {}) {
|
|
|
5799
5800
|
break;
|
|
5800
5801
|
}
|
|
5801
5802
|
mutate(item).directives = directives;
|
|
5802
|
-
|
|
5803
|
+
if (tok !== Token.NamespaceKeyword) {
|
|
5804
|
+
mutate(item).docs = docs;
|
|
5805
|
+
}
|
|
5803
5806
|
if (isBlocklessNamespace(item)) {
|
|
5804
5807
|
if (seenBlocklessNs) {
|
|
5805
5808
|
error({ code: "multiple-blockless-namespace", target: item });
|
|
@@ -5847,7 +5850,7 @@ function createParser(code, options = {}) {
|
|
|
5847
5850
|
item = parseScalarStatement(pos, decorators);
|
|
5848
5851
|
break;
|
|
5849
5852
|
case Token.NamespaceKeyword:
|
|
5850
|
-
const ns = parseNamespaceStatement(pos, decorators);
|
|
5853
|
+
const ns = parseNamespaceStatement(pos, decorators, docs);
|
|
5851
5854
|
if (!Array.isArray(ns.statements)) {
|
|
5852
5855
|
error({ code: "blockless-namespace-first", messageId: "topLevel", target: ns });
|
|
5853
5856
|
}
|
|
@@ -5894,7 +5897,9 @@ function createParser(code, options = {}) {
|
|
|
5894
5897
|
break;
|
|
5895
5898
|
}
|
|
5896
5899
|
mutate(item).directives = directives;
|
|
5897
|
-
|
|
5900
|
+
if (tok !== Token.NamespaceKeyword) {
|
|
5901
|
+
mutate(item).docs = docs;
|
|
5902
|
+
}
|
|
5898
5903
|
stmts.push(item);
|
|
5899
5904
|
}
|
|
5900
5905
|
return stmts;
|
|
@@ -5913,7 +5918,7 @@ function createParser(code, options = {}) {
|
|
|
5913
5918
|
}
|
|
5914
5919
|
return directives;
|
|
5915
5920
|
}
|
|
5916
|
-
function parseNamespaceStatement(pos, decorators) {
|
|
5921
|
+
function parseNamespaceStatement(pos, decorators, docs) {
|
|
5917
5922
|
parseExpected(Token.NamespaceKeyword);
|
|
5918
5923
|
let currentName = parseIdentifierOrMemberExpression();
|
|
5919
5924
|
const nsSegments = [];
|
|
@@ -5931,6 +5936,7 @@ function createParser(code, options = {}) {
|
|
|
5931
5936
|
let outerNs = {
|
|
5932
5937
|
kind: SyntaxKind.NamespaceStatement,
|
|
5933
5938
|
decorators,
|
|
5939
|
+
docs: docs,
|
|
5934
5940
|
id: nsSegments[0],
|
|
5935
5941
|
locals: undefined,
|
|
5936
5942
|
statements,
|