Skip to content

Commit

Permalink
chore(workspace): upgrade ts (#136)
Browse files Browse the repository at this point in the history
* ts v5

* update fragmetn tests

* tests

* last fixes

* fixes

* add changeset
  • Loading branch information
JoviDeCroock authored Dec 10, 2023
1 parent 1ae3f92 commit 3b3d9cb
Show file tree
Hide file tree
Showing 14 changed files with 86 additions and 134 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-paws-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@0no-co/graphqlsp': patch
---

Upgrade TypeScript dependency, this would normally not result in a changeset but it had us remove the normal auto-complete and quick-info and only do that logic when ours ends up in no results
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"lint-staged": "^15.0.0",
"prettier": "^2.8.7",
"rollup": "^3.20.2",
"typescript": "^5.0.0",
"typescript": "^5.3.3",
"vitest": "^0.34.6"
}
}
2 changes: 1 addition & 1 deletion packages/example-external-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"@graphql-codegen/cli": "^5.0.0",
"@graphql-codegen/client-preset": "^4.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
"typescript": "^5.3.3"
}
}
2 changes: 1 addition & 1 deletion packages/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@graphql-typed-document-node/core": "^3.2.0"
},
"devDependencies": {
"typescript": "^5.0.0",
"typescript": "^5.3.3",
"@0no-co/graphqlsp": "file:../graphqlsp"
}
}
2 changes: 1 addition & 1 deletion packages/graphqlsp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@types/node": "^18.15.11",
"@types/node-fetch": "^2.6.3",
"graphql": "^16.8.1",
"typescript": "^5.0.0"
"typescript": "^5.3.3"
},
"dependencies": {
"@graphql-codegen/add": "^5.0.0",
Expand Down
37 changes: 17 additions & 20 deletions packages/graphqlsp/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,21 @@ function create(info: ts.server.PluginCreateInfo) {
info
);

const originalCompletions = info.languageService.getCompletionsAtPosition(
filename,
cursorPosition,
options
) || {
isGlobalCompletion: false,
isMemberCompletion: false,
isNewIdentifierLocation: false,
entries: [],
};

if (completions) {
return {
...completions,
entries: [...completions.entries, ...originalCompletions.entries],
};
if (completions && completions.entries.length) {
return completions;
} else {
return originalCompletions;
return (
info.languageService.getCompletionsAtPosition(
filename,
cursorPosition,
options
) || {
isGlobalCompletion: false,
isMemberCompletion: false,
isNewIdentifierLocation: false,
entries: [],
}
);
}
};

Expand All @@ -120,12 +117,12 @@ function create(info: ts.server.PluginCreateInfo) {
info
);

const originalInfo = info.languageService.getQuickInfoAtPosition(
if (quickInfo) return quickInfo;

return info.languageService.getQuickInfoAtPosition(
filename,
cursorPosition
);

return quickInfo || originalInfo;
};

logger('proxy: ' + JSON.stringify(proxy));
Expand Down
58 changes: 29 additions & 29 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 0 additions & 55 deletions test/e2e/client-preset.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,61 +341,6 @@ List out all Pokémon, optionally in pages`
"name": "__typename",
"sortText": "14__typename",
},
{
"kind": "string",
"kindModifiers": "",
"name": "
fragment pokemonFields on Pokemon {
id
name
attacks {
fast {
damage
name
}
}
}
",
"replacementSpan": {
"end": {
"line": 10,
"offset": 1,
},
"start": {
"line": 3,
"offset": 39,
},
},
"sortText": "11",
},
{
"kind": "string",
"kindModifiers": "",
"name": "
query Pok($limit: Int!) {
pokemons(limit: $limit) {
id
name
fleeRate
classification
...pokemonFields
...weaknessFields
__typename
}
}
",
"replacementSpan": {
"end": {
"line": 10,
"offset": 1,
},
"start": {
"line": 3,
"offset": 39,
},
},
"sortText": "11",
},
]
`);
}, 30000);
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/fixture-project-client-preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"@urql/core": "^4.0.4"
},
"devDependencies": {
"typescript": "^5.0.4"
"typescript": "^5.3.3"
}
}
2 changes: 1 addition & 1 deletion test/e2e/fixture-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"@urql/core": "^4.0.4"
},
"devDependencies": {
"typescript": "^5.0.4"
"typescript": "^5.3.3"
}
}
Loading

0 comments on commit 3b3d9cb

Please sign in to comment.