Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(workspace): upgrade ts #136

Merged
merged 6 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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