Skip to content
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

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

## [0.8.1] - 2025-05-29

Fixed error with buffer files.

## [0.8.0] - 2025-05-29

### Added
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"Tact",
"Smart contract"
],
"version": "0.8.0",
"version": "0.8.1",
"engines": {
"vscode": "^1.63.0"
},
Expand Down
2 changes: 1 addition & 1 deletion package.server.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tact-lang/tact-language-server",
"version": "0.8.0",
"version": "0.8.1",
"description": "Language Server for Tact",
"main": "server.js",
"keywords": ["TON", "The Open Network", "Tact", "Smart contract", "language server"],
Expand Down
18 changes: 12 additions & 6 deletions server/src/files.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import * as lsp from "vscode-languageserver"
import {TextDocument} from "vscode-languageserver-textdocument"
import {TactFile} from "@server/languages/tact/psi/TactFile"
import {fileURLToPath, pathToFileURL} from "node:url"
import {pathToFileURL} from "node:url"
import {createFiftParser, createTactParser, createTlbParser} from "@server/parser"
import * as fs from "node:fs"
import {FiftFile} from "@server/languages/fift/psi/FiftFile"
import {TlbFile} from "@server/languages/tlb/psi/TlbFile"
import {URI} from "vscode-uri"

export const PARSED_FILES_CACHE: Map<string, TactFile> = new Map()
export const FIFT_PARSED_FILES_CACHE: Map<string, FiftFile> = new Map()
Expand Down Expand Up @@ -38,11 +39,6 @@ export function reparseTactFile(uri: string, content: string): TactFile {
return file
}

export const filePathToUri = (filePath: string): string => {
const url = pathToFileURL(filePath).toString()
return url.replace(/c:/g, "c%3A").replace(/d:/g, "d%3A")
}

export function findFiftFile(uri: string): FiftFile {
const cached = FIFT_PARSED_FILES_CACHE.get(uri)
if (cached !== undefined) {
Expand Down Expand Up @@ -119,3 +115,13 @@ export const isTlbFile = (
uri: string,
event?: lsp.TextDocumentChangeEvent<TextDocument>,
): boolean => event?.document.languageId === "tlb" || uri.endsWith(".tlb")

export const filePathToUri = (filePath: string): string => {
const url = pathToFileURL(filePath).toString()
return url.replace(/c:/g, "c%3A").replace(/d:/g, "d%3A")
}

function fileURLToPath(uri: string): string {
const normalizedUri = uri.replace(/\\/g, "/")
return URI.parse(normalizedUri).fsPath
}
Loading