Skip to content

fix: fix windows compat#231

Merged
hardfist merged 2 commits intomainfrom
use-ls
Aug 11, 2025
Merged

fix: fix windows compat#231
hardfist merged 2 commits intomainfrom
use-ls

Conversation

@hardfist
Copy link
Copy Markdown
Contributor

@hardfist hardfist commented Aug 11, 2025

use ls.DocumentUriToFilename for UriToPath for better windows compat

@hardfist hardfist changed the title chore: use ls chore: use ls.DocumentUriToFilename Aug 11, 2025
@hardfist hardfist marked this pull request as ready for review August 11, 2025 16:41
Copilot AI review requested due to automatic review settings August 11, 2025 16:41
@hardfist hardfist changed the title chore: use ls.DocumentUriToFilename fix: fix windows compat Aug 11, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces a custom uriToPath function with the standard ls.DocumentUriToFilename function to improve Windows compatibility for URI-to-file-path conversion in the LSP server implementation.

Key changes:

  • Replaces custom URI parsing logic with the TypeScript-Go library's built-in function
  • Comments out unused function declarations in the shim layer
  • Updates function signatures to use proper lsproto.DocumentUri types

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
shim/ls/shim.go Comments out unused function declarations and maintains the DocumentURIToFileName export
go.mod Adds dependency on github.com/microsoft/typescript-go/shim/ls module
cmd/rslint/lsp.go Replaces custom uriToPath implementation with ls.DocumentURIToFileName and updates call sites

type Definition = ls.Definition
//go:linkname DeprecateSortText github.com/microsoft/typescript-go/internal/ls.DeprecateSortText
func DeprecateSortText(original ls.sortText) ls.sortText
////go:linkname DeprecateSortText github.com/microsoft/typescript-go/internal/ls.DeprecateSortText
Copy link

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment syntax is inconsistent. Use // instead of //// for commenting out the go:linkname directive.

Suggested change
////go:linkname DeprecateSortText github.com/microsoft/typescript-go/internal/ls.DeprecateSortText
//go:linkname DeprecateSortText github.com/microsoft/typescript-go/internal/ls.DeprecateSortText

Copilot uses AI. Check for mistakes.
func FileNameToDocumentURI(fileName string) lsproto.DocumentUri
//go:linkname GetCompletionItemData github.com/microsoft/typescript-go/internal/ls.GetCompletionItemData
func GetCompletionItemData(item *lsproto.CompletionItem) (*ls.itemData, error)
////go:linkname GetCompletionItemData github.com/microsoft/typescript-go/internal/ls.GetCompletionItemData
Copy link

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment syntax is inconsistent. Use // instead of //// for commenting out the go:linkname directive.

Suggested change
////go:linkname GetCompletionItemData github.com/microsoft/typescript-go/internal/ls.GetCompletionItemData
//go:linkname GetCompletionItemData github.com/microsoft/typescript-go/internal/ls.GetCompletionItemData

Copilot uses AI. Check for mistakes.
func NewLanguageService(host ls.Host) *ls.LanguageService
//go:linkname NewSymbolAndEntries github.com/microsoft/typescript-go/internal/ls.NewSymbolAndEntries
func NewSymbolAndEntries(kind ls.definitionKind, node *ast.Node, symbol *ast.Symbol, references []*ls.referenceEntry) *ls.SymbolAndEntries
////go:linkname NewSymbolAndEntries github.com/microsoft/typescript-go/internal/ls.NewSymbolAndEntries
Copy link

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment syntax is inconsistent. Use // instead of //// for commenting out the go:linkname directive.

Suggested change
////go:linkname NewSymbolAndEntries github.com/microsoft/typescript-go/internal/ls.NewSymbolAndEntries
//go:linkname NewSymbolAndEntries github.com/microsoft/typescript-go/internal/ls.NewSymbolAndEntries

Copilot uses AI. Check for mistakes.
@hardfist hardfist merged commit 172a08b into main Aug 11, 2025
4 checks passed
@hardfist hardfist deleted the use-ls branch August 11, 2025 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants