Skip to content

Commit

Permalink
feat(project): assume pylance until proper refactorings can be done.
Browse files Browse the repository at this point in the history
Signed-off-by: Braden Mars <bradenmars@bradenmars.me>
  • Loading branch information
BradenM committed Jan 30, 2023
1 parent bbdc936 commit 2610c2a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions micropy/project/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
import os
from itertools import chain
from pathlib import Path
from typing import Iterator, List
from typing import Iterator, List, Union

from jinja2 import Environment, FileSystemLoader
from micropy.logger import Log

from .checks import TEMPLATE_CHECKS
from typing_extensions import Literal


class Template:
Expand Down Expand Up @@ -170,10 +169,14 @@ class CodeTemplate(Template):
"""Template for VSCode settings."""

FILENAME = ".vscode/settings.json"
CHECKS = [TEMPLATE_CHECKS["ms-python"]]

# TODO: rewrite this module and have proper DI
language_server: Union[Literal["mpls"] | Literal["pylance"]]

def __init__(self, *args, **kwargs):
self.update_method = self.update_as_json
# TODO: but for now, assume pylance.
self.language_server = kwargs.get("language_server", "pylance")
super().__init__(*args, **kwargs)

@property
Expand All @@ -188,6 +191,7 @@ def context(self):
ctx = {
"stubs": self.stubs or [],
"paths": stub_paths,
"language_server": self.language_server,
}
return ctx

Expand Down Expand Up @@ -215,7 +219,7 @@ def context(self):


class TemplateProvider:
"""Template Factory."""
"""Template Provider."""

_template_files = {
"vscode": CodeTemplate,
Expand All @@ -231,7 +235,7 @@ class TemplateProvider:
TEMPLATES = {
"vscode": (
["vscode", "vsextensions"],
("VSCode Settings for " "Autocompletion/Intellisense"),
"VSCode Settings for Autocompletion/Intellisense",
),
"pymakr": (["pymakr"], "Pymakr Configuration"),
"pylint": (["pylint"], "Pylint MicroPython Settings"),
Expand Down

0 comments on commit 2610c2a

Please sign in to comment.