Skip to content

Commit 7f9db76

Browse files
authored
fix(indexing): fix buffer files handling (#750)
Fixes #749
1 parent 733546c commit 7f9db76

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.8.1] - 2025-05-29
6+
7+
Fixed error with buffer files.
8+
59
## [0.8.0] - 2025-05-29
610

711
### Added

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"Tact",
99
"Smart contract"
1010
],
11-
"version": "0.8.0",
11+
"version": "0.8.1",
1212
"engines": {
1313
"vscode": "^1.63.0"
1414
},

package.server.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tact-lang/tact-language-server",
3-
"version": "0.8.0",
3+
"version": "0.8.1",
44
"description": "Language Server for Tact",
55
"main": "server.js",
66
"keywords": ["TON", "The Open Network", "Tact", "Smart contract", "language server"],

server/src/files.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import * as lsp from "vscode-languageserver"
22
import {TextDocument} from "vscode-languageserver-textdocument"
33
import {TactFile} from "@server/languages/tact/psi/TactFile"
4-
import {fileURLToPath, pathToFileURL} from "node:url"
4+
import {pathToFileURL} from "node:url"
55
import {createFiftParser, createTactParser, createTlbParser} from "@server/parser"
66
import * as fs from "node:fs"
77
import {FiftFile} from "@server/languages/fift/psi/FiftFile"
88
import {TlbFile} from "@server/languages/tlb/psi/TlbFile"
9+
import {URI} from "vscode-uri"
910

1011
export const PARSED_FILES_CACHE: Map<string, TactFile> = new Map()
1112
export const FIFT_PARSED_FILES_CACHE: Map<string, FiftFile> = new Map()
@@ -38,11 +39,6 @@ export function reparseTactFile(uri: string, content: string): TactFile {
3839
return file
3940
}
4041

41-
export const filePathToUri = (filePath: string): string => {
42-
const url = pathToFileURL(filePath).toString()
43-
return url.replace(/c:/g, "c%3A").replace(/d:/g, "d%3A")
44-
}
45-
4642
export function findFiftFile(uri: string): FiftFile {
4743
const cached = FIFT_PARSED_FILES_CACHE.get(uri)
4844
if (cached !== undefined) {
@@ -119,3 +115,13 @@ export const isTlbFile = (
119115
uri: string,
120116
event?: lsp.TextDocumentChangeEvent<TextDocument>,
121117
): boolean => event?.document.languageId === "tlb" || uri.endsWith(".tlb")
118+
119+
export const filePathToUri = (filePath: string): string => {
120+
const url = pathToFileURL(filePath).toString()
121+
return url.replace(/c:/g, "c%3A").replace(/d:/g, "d%3A")
122+
}
123+
124+
function fileURLToPath(uri: string): string {
125+
const normalizedUri = uri.replace(/\\/g, "/")
126+
return URI.parse(normalizedUri).fsPath
127+
}

0 commit comments

Comments
 (0)