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

Another cool release! #103

Merged
merged 23 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b65558e
feat: New code actions: extract to arrow function above!
zardoy Feb 15, 2023
980186c
commit codeactions files :xd:
zardoy Feb 15, 2023
37bb04b
[wip] language-overridable settings
zardoy Feb 15, 2023
d2c5168
cast to FullSouceFile for more robust unstable ts typechecking
zardoy Feb 15, 2023
01f5f8c
rename function on its declaration
zardoy Feb 15, 2023
d296f3d
feat: Enable `extractTypeInferName` by default with ability to specif…
zardoy Feb 15, 2023
c20598d
refactor: evaluate workspaceConfiguration once
zardoy Feb 15, 2023
8029595
add workspace settings for convenient work with typescript imports
zardoy Feb 15, 2023
9cb7f19
refactor: make code cleaner by using only ls and ls host
zardoy Feb 15, 2023
58f9829
feat: Add `libDomPatching` that adds more completions for events (for…
zardoy Feb 15, 2023
7d129ff
docs: up replaceSuggestions description
zardoy Feb 15, 2023
c4dfb5b
fix build
zardoy Feb 15, 2023
063e7b6
add support for optional extension icon
zardoy Feb 15, 2023
2ca5ae4
fix changeStringReplaceToRegex: handle \n and \t
zardoy Feb 16, 2023
962d449
docs: add short description to top
zardoy Feb 17, 2023
3517dbb
docs: make desc longer
zardoy Feb 17, 2023
26cc345
ts5 fix getNodeAtPosition crash
zardoy Feb 17, 2023
e849dba
discard cache after 1s for empty result (probably errored)
zardoy Feb 17, 2023
49e6f9c
fix(patch-outline): fix outline crash in ts5.0. Make patching more st…
zardoy Feb 17, 2023
15c69b4
refactor: move getCompletionEntryDetails impl into its own file
zardoy Feb 17, 2023
2ef7de5
feat: Now you can exclude non-contextual signature help on manual tri…
zardoy Feb 17, 2023
19c0a03
fix: add kinds to refactorings
zardoy Feb 17, 2023
cf8e348
fix: make type-driven completions publically available with typescrip…
zardoy Feb 17, 2023
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
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}
OVSX_PAT: ${{ secrets.OVSX_PAT }}
# optional
EXTENSION_ICON: ${{ secrets.EXTENSION_ICON }}
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
{
"tsEssentialPlugins.autoImport.changeToNamespaceImport": {
"typescript": {
"namespace": "ts",
"addImport": false
}
},
"tsEssentialPlugins.suggestions.ignoreAutoImports": [
"typescript-full"
],
"betterSnippets.customSnippets": [
{
"name": "SyntaxKind",
Expand Down
17 changes: 15 additions & 2 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
# TypeScript Essential Plugins

Feature-complete TypeScript plugin that improves every single builtin feature such as completions, definitions, references and so on, and also adds even new TypeScript killer features, so you can work with large codebases faster!
We make completions more informative. Definitions, references (and sometimes even completions) less noisy. And finally our main goal is to provide most customizable TypeScript experience for IDE features.

TOC:

- [Top Features](#top-features)
- [Minor Useful Features](#minor-useful-features)
- [Auto Imports](#auto-imports)
- [Rename Features](#rename-features)
- [Special Commands List](#special-commands-list)
- [Contributed Code Actions](#contributed-code-actions)
- [Even Even More](#even-even-more)

## Top Features

> Here React experience hits different!
> Note: With this plugin React experience hits different! (see below)

### Special Commands & Actions

Expand Down Expand Up @@ -364,4 +377,4 @@ const a = {

## Even Even More

Please look at extension settings, as this extension has much more features than described here!
Also please take a look at extension settings, as this extension has much more features than described here!
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
"esbuild": "^0.16.16",
"fs-extra": "^10.1.0",
"got": "^12.5.3",
"got-cjs": "npm:got@^11.x",
"type-fest": "^2.13.1",
"typed-jsonfile": "^0.2.1",
"typescript": "^4.9.3",
Expand Down
123 changes: 115 additions & 8 deletions pnpm-lock.yaml

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

9 changes: 5 additions & 4 deletions src/apiCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { sendCommand } from './sendCommand'
export default () => {
/** @unique */
const cacheableCommands: Set<(typeof passthroughExposedApiCommands)[number]> = new Set(['getNodePath', 'getSpanOfEnclosingComment', 'getNodeAtPosition'])
const operationsCache = new Map<string, { key: string; data }>()
const operationsCache = new Map<string, { key: string; data; time?: number }>()
const sharedRequest = async (type: TriggerCharacterCommand, { offset, relativeOffset = 0, document, position }: RequestOptions) => {
if (position && offset) throw new Error('Only position or offset parameter can be provided')
if (document && !offset && !position) throw new Error('When custom document is provided, offset or position must be provided')
Expand All @@ -18,10 +18,11 @@ export default () => {
const requestOffset = offset ?? document.offsetAt(position!)
const requestPos = position ?? document.positionAt(offset!)
const getData = async () => sendCommand(type, { document: document!, position: requestPos })
const CACHE_UNDEFINED_TIMEOUT = 1000
if (cacheableCommands.has(type as any)) {
const cacheEntry = operationsCache.get(type)
const operationKey = `${document.uri.toString()}:${document.version}:${requestOffset}`
if (cacheEntry?.key === operationKey) {
if (cacheEntry?.key === operationKey && cacheEntry?.time && Date.now() - cacheEntry.time < CACHE_UNDEFINED_TIMEOUT) {
return cacheEntry.data
}

Expand All @@ -31,9 +32,9 @@ export default () => {
// at the same time:
// extension 2 completion provider requests API data at the same document and position
// and so on
operationsCache.set(type, { key: operationKey, data })
operationsCache.set(type, { key: operationKey, data, time: data === undefined ? Date.now() : undefined })
if (type === 'getNodePath') {
operationsCache.set('getNodeAtPosition', { key: operationKey, data: data.then((path: any) => path[path.length - 1]) })
operationsCache.set('getNodeAtPosition', { key: operationKey, data: data.then((path: any) => path?.[path.length - 1]) })
}

return data
Expand Down
Loading