Skip to content

Commit

Permalink
upgrade TS from 4 to 5.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
phil294 committed Aug 6, 2023
1 parent 1f97008 commit 1c4cf00
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 19 deletions.
4 changes: 2 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
"dependencies": {
"coffeescript": "github:edemaine/coffeescript#var-assign",
"jshashes": "^1.0.8",
"typescript": "^4.7.1-rc",
"typescript": "^5.1.6",
"volatile-map": "^2.0.0",
"vscode-languageserver": "7.0.0",
"vscode-languageserver-textdocument": "^1.0.4",
"vscode-uri": "^3.0.3"
},
"resolutions": {
"typescript": "^4.7.1-rc"
"typescript": "^5.1.6"
},
"devDependencies": {
"@types/coffeescript": "^2.5.1",
Expand Down
9 changes: 5 additions & 4 deletions server/src/modes/script/javascript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { isVCancellationRequested, VCancellationToken } from '../../utils/cancel
import { getFileFsPath, getFilePath } from '../../utils/paths';
import { NULL_SIGNATURE } from '../nullMode';
import * as Previewer from './previewer';
import { HighlightSpanKind } from 'typescript';



Expand Down Expand Up @@ -147,9 +148,9 @@ export async function getJavascriptMode(
// Position of errors shown at variable declaration are most often useless, it would
// be better to show them at their (first) usage instead which implies declaration
// in CS. Luckily, this is possible using highlight querying:
const occurrence = service.getOccurrencesAtPosition(fileFsPath, js_doc.offsetAt(range.start))?.[1]
const occurrence = service.getDocumentHighlights(fileFsPath, js_doc.offsetAt(range.start), [fileFsPath])?.[0]?.highlightSpans[1]
if(occurrence)
range = convertRange(js_doc, occurrence.textSpan)
range = convertRange(js_doc, occurrence. textSpan)
}

if(transpilation.source_map) {
Expand Down Expand Up @@ -697,7 +698,7 @@ export async function getJavascriptMode(

position = transpile_service.position_coffee_to_js(transpilation, position, coffee_doc) || position

const occurrences = service.getOccurrencesAtPosition(fileFsPath, js_doc.offsetAt(position));
const occurrences = service.getDocumentHighlights(fileFsPath, js_doc.offsetAt(position), [fileFsPath])?.[0]?.highlightSpans;
if (occurrences) {
return occurrences
.map(entry => ({
Expand All @@ -714,7 +715,7 @@ export async function getJavascriptMode(
}
return {
range,
kind: entry.isWriteAccess ? DocumentHighlightKind.Write : DocumentHighlightKind.Text
kind: entry.kind === HighlightSpanKind.writtenReference ?DocumentHighlightKind.Write : DocumentHighlightKind.Text
};
});
}
Expand Down
8 changes: 4 additions & 4 deletions server/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1263,10 +1263,10 @@ type-fest@^0.20.2:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4"
integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==

typescript@^4.7.1-rc:
version "4.9.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==
typescript@^5.1.6:
version "5.1.6"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274"
integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==

update-browserslist-db@^1.0.11:
version "1.0.11"
Expand Down
4 changes: 2 additions & 2 deletions test/completionHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ export async function testCompletion({ doc_uri, position, expected_items: expect
let match_index = -1
if (typeof ei === 'string') {
match_index = result.items.findIndex(i => {
return i.label === ei &&
return i.label === ei && i.kind &&
// Omit standard matches like variable as these primarily yield false positives.
// If these are really required, they can be passed separately.
[CompletionItemKind.Function, CompletionItemKind.Property, CompletionItemKind.Field].includes(i.kind || -1)
[CompletionItemKind.Function, CompletionItemKind.Property, CompletionItemKind.Field].includes(i.kind)
})
assert.ok(match_index > -1,
`Can't find matching item for\n${JSON.stringify(ei, null, 2)}\nSeen items:\n${JSON.stringify(
Expand Down
4 changes: 2 additions & 2 deletions test/lsp/features/completion/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ describe('Should autocomplete', () => {
})

it('completes open string as inline object param', async () => {
await testCompletion({ doc_uri: getDocUri('completion/open-string-as-inline-object-param.coffee'), position: position(0, 28), expected_items: ['smooth'] })
await testCompletion({ doc_uri: getDocUri('completion/open-string-as-inline-object-param.coffee'), position: position(0, 28), expected_items: ['smooth', 'instant'] })
})
it('completes empty open string as inline object param', async () => {
await testCompletion({ doc_uri: getDocUri('completion/open-empty-string-as-inline-object-param.coffee'), position: position(0, 27), expected_items: ['smooth', 'auto'] })
await testCompletion({ doc_uri: getDocUri('completion/open-empty-string-as-inline-object-param.coffee'), position: position(0, 27), expected_items: ['smooth', 'auto', 'instant'] })
})

it('completes open string as function param, indented', async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/lsp/fixture/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
},
"devDependencies": {
"@types/lodash": "4.14.77",
"typescript": "^4.7.1-rc"
"typescript": "^5.1.6"
}
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3013,10 +3013,10 @@ typed-rest-client@^1.8.4:
tunnel "0.0.6"
underscore "^1.12.1"

typescript@^4.7.1-rc:
version "4.9.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==
typescript@^5.1.6:
version "5.1.6"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274"
integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==

uc.micro@^1.0.1, uc.micro@^1.0.5:
version "1.0.6"
Expand Down

0 comments on commit 1c4cf00

Please sign in to comment.