Skip to content

Commit

Permalink
fix: stupid windows paths
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNuclearNexus committed Sep 26, 2024
1 parent 8657b53 commit 03a4386
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
10 changes: 3 additions & 7 deletions language_server/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging
import sys
from typing import Iterator, List
import pathlib
from beet import (
Context,
GenericPlugin,
Expand Down Expand Up @@ -162,11 +163,6 @@ def create_context(config: ProjectConfig, config_path: Path) -> Context:
with ProjectBuilderShadow(project, root=True).build() as ctx:
mc = ctx.inject(Mecha)

logging.debug(mc.steps)

# for mod in ctx.data[Module]:
# logging.debug(mod)

logging.debug(f"Mecha created for {config_path} successfully")
for pack in ctx.packs:
for provider in mc.providers:
Expand All @@ -176,8 +172,8 @@ def create_context(config: ProjectConfig, config_path: Path) -> Context:

for location, file in pack.all():
try:
path = file.ensure_source_path()
logging.debug(path)
path = os.path.normpath(file.ensure_source_path())
path = os.path.normcase(path)
PATH_TO_RESOURCE[str(path)] = (location, file)
except:
continue
Expand Down
8 changes: 5 additions & 3 deletions language_server/server/features/validate.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from dataclasses import dataclass
import logging
import os
import traceback
from typing import Any
from beet import Context, Function, TextFileBase
Expand Down Expand Up @@ -76,15 +77,16 @@ def validate_function(
ls: MechaLanguageServer, ctx: Context, text_doc: TextDocument
) -> list[InvalidSyntax]:
logging.debug(f"Parsing function:\n{text_doc.source}")
logging.debug(text_doc.path)

if text_doc.path not in PATH_TO_RESOURCE:
path = os.path.normcase(os.path.normpath(text_doc.path))

if path not in PATH_TO_RESOURCE:
COMPILATION_RESULTS[text_doc.uri] = CompiledDocument(
ctx, "", None, [], None, None
)
return []

location, file = PATH_TO_RESOURCE[text_doc.path]
location, file = PATH_TO_RESOURCE[path]

if not isinstance(file, Function) and not isinstance(file, Module):
COMPILATION_RESULTS[text_doc.uri] = CompiledDocument(
Expand Down

0 comments on commit 03a4386

Please sign in to comment.