Skip to content

Commit

Permalink
Merge pull request #375 from fortran-lang/maint/schema
Browse files Browse the repository at this point in the history
chore: update pydantic dependency to version 2.7.0
  • Loading branch information
gnikit committed Apr 14, 2024
2 parents 0cf1edc + 80ded61 commit 522307d
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 71 deletions.
134 changes: 67 additions & 67 deletions fortls/fortls.schema.json
@@ -1,193 +1,193 @@
{
"title": "fortls schema",
"description": "Schema for the fortls Fortran Language Server",
"type": "object",
"properties": {
"config": {
"title": "Config",
"description": "Configuration options file (default file name: .fortlsrc, other default supported names: .fortls.json, .fortls)",
"default": ".fortlsrc",
"description": "Configuration options file (default file name: .fortlsrc, other default supported names: .fortls.json, .fortls)",
"title": "Config",
"type": "string"
},
"nthreads": {
"title": "Nthreads",
"description": "Number of threads to use during workspace initialization (default: 4)",
"default": 4,
"description": "Number of threads to use during workspace initialization (default: 4)",
"title": "Nthreads",
"type": "integer"
},
"notify_init": {
"title": "Notify Init",
"description": "Send notification message when workspace initialization is complete",
"default": false,
"description": "Send notification message when workspace initialization is complete",
"title": "Notify Init",
"type": "boolean"
},
"incremental_sync": {
"title": "Incremental Sync",
"description": "Use incremental document synchronization (beta)",
"default": false,
"description": "Use incremental document synchronization (beta)",
"title": "Incremental Sync",
"type": "boolean"
},
"recursion_limit": {
"title": "Recursion Limit",
"description": "Set the maximum recursion depth for the parser (default: 1000)",
"default": 1000,
"description": "Set the maximum recursion depth for the parser (default: 1000)",
"title": "Recursion Limit",
"type": "integer"
},
"sort_keywords": {
"title": "Sort Keywords",
"description": "Display variable keywords information, function/subroutine definitions, etc. in a consistent (sorted) manner default: no sorting, display code as is)",
"default": false,
"description": "Display variable keywords information, function/subroutine definitions, etc. in a consistent (sorted) manner default: no sorting, display code as is)",
"title": "Sort Keywords",
"type": "boolean"
},
"disable_autoupdate": {
"title": "Disable Autoupdate",
"description": "fortls automatically checks PyPi for newer version and installs them.Use this option to disable the autoupdate feature.",
"default": false,
"description": "fortls automatically checks PyPi for newer version and installs them.Use this option to disable the autoupdate feature.",
"title": "Disable Autoupdate",
"type": "boolean"
},
"preserve_keyword_order": {
"title": "Preserve Keyword Order",
"description": "DEPRECATED, this is now the default. To sort use sort_keywords",
"default": false,
"description": "DEPRECATED, this is now the default. To sort use sort_keywords",
"title": "Preserve Keyword Order",
"type": "boolean"
},
"debug_log": {
"title": "Debug Log",
"description": "Generate debug log in project root folder",
"default": false,
"description": "Generate debug log in project root folder",
"title": "Debug Log",
"type": "boolean"
},
"source_dirs": {
"title": "Source Dirs",
"description": "Folders containing source files (default: set())",
"default": [],
"type": "array",
"description": "Folders containing source files (default: set())",
"items": {},
"title": "Source Dirs",
"type": "array",
"uniqueItems": true
},
"incl_suffixes": {
"title": "Incl Suffixes",
"description": "Consider additional file extensions to the default (default: .F, .F77, .F90, .F95, .F03, .F08, .FOR, .FPP (lower & upper casing))",
"default": [],
"type": "array",
"description": "Consider additional file extensions to the default (default: .F, .F77, .F90, .F95, .F03, .F08, .FOR, .FPP (lower & upper casing))",
"items": {},
"title": "Incl Suffixes",
"type": "array",
"uniqueItems": true
},
"excl_suffixes": {
"title": "Excl Suffixes",
"description": "Source file extensions to be excluded (default: set())",
"default": [],
"type": "array",
"description": "Source file extensions to be excluded (default: set())",
"items": {},
"title": "Excl Suffixes",
"type": "array",
"uniqueItems": true
},
"excl_paths": {
"title": "Excl Paths",
"description": "Folders to exclude from parsing",
"default": [],
"type": "array",
"description": "Folders to exclude from parsing",
"items": {},
"title": "Excl Paths",
"type": "array",
"uniqueItems": true
},
"autocomplete_no_prefix": {
"title": "Autocomplete No Prefix",
"description": "Do not filter autocomplete results by variable prefix",
"default": false,
"description": "Do not filter autocomplete results by variable prefix",
"title": "Autocomplete No Prefix",
"type": "boolean"
},
"autocomplete_no_snippets": {
"title": "Autocomplete No Snippets",
"description": "Do not use snippets with place holders in autocomplete results",
"default": false,
"description": "Do not use snippets with place holders in autocomplete results",
"title": "Autocomplete No Snippets",
"type": "boolean"
},
"autocomplete_name_only": {
"title": "Autocomplete Name Only",
"description": "Complete only the name of procedures and not the parameters",
"default": false,
"description": "Complete only the name of procedures and not the parameters",
"title": "Autocomplete Name Only",
"type": "boolean"
},
"lowercase_intrinsics": {
"title": "Lowercase Intrinsics",
"description": "Use lowercase for intrinsics and keywords in autocomplete requests",
"default": false,
"description": "Use lowercase for intrinsics and keywords in autocomplete requests",
"title": "Lowercase Intrinsics",
"type": "boolean"
},
"use_signature_help": {
"title": "Use Signature Help",
"description": "Use signature help instead of subroutine/function snippets. This effectively sets --autocomplete_no_snippets",
"default": false,
"description": "Use signature help instead of subroutine/function snippets. This effectively sets --autocomplete_no_snippets",
"title": "Use Signature Help",
"type": "boolean"
},
"variable_hover": {
"title": "Variable Hover",
"description": "DEPRECATED: This option is always on. Show hover information for variables",
"default": false,
"description": "DEPRECATED: This option is always on. Show hover information for variables",
"title": "Variable Hover",
"type": "boolean"
},
"hover_signature": {
"title": "Hover Signature",
"description": "Show signature information in hover for arguments ",
"default": false,
"description": "Show signature information in hover for arguments ",
"title": "Hover Signature",
"type": "boolean"
},
"hover_language": {
"title": "Hover Language",
"description": "Language used for responses to hover requests a VSCode language id (default: fortran90)",
"default": "fortran90",
"description": "Language used for responses to hover requests a VSCode language id (default: fortran90)",
"title": "Hover Language",
"type": "string"
},
"max_line_length": {
"title": "Max Line Length",
"description": "Maximum line length (default: -1)",
"default": -1,
"description": "Maximum line length (default: -1)",
"title": "Max Line Length",
"type": "integer"
},
"max_comment_line_length": {
"title": "Max Comment Line Length",
"description": "Maximum comment line length (default: -1)",
"default": -1,
"description": "Maximum comment line length (default: -1)",
"title": "Max Comment Line Length",
"type": "integer"
},
"disable_diagnostics": {
"title": "Disable Diagnostics",
"description": "Disable diagnostics",
"default": false,
"description": "Disable diagnostics",
"title": "Disable Diagnostics",
"type": "boolean"
},
"pp_suffixes": {
"title": "Pp Suffixes",
"description": "File extensions to be parsed ONLY for preprocessor commands (default: all uppercase source file suffixes)",
"default": [],
"type": "array",
"description": "File extensions to be parsed ONLY for preprocessor commands (default: all uppercase source file suffixes)",
"items": {},
"title": "Pp Suffixes",
"type": "array",
"uniqueItems": true
},
"include_dirs": {
"title": "Include Dirs",
"description": "Folders containing preprocessor files with extensions PP_SUFFIXES.",
"default": [],
"type": "array",
"description": "Folders containing preprocessor files with extensions PP_SUFFIXES.",
"items": {},
"title": "Include Dirs",
"type": "array",
"uniqueItems": true
},
"pp_defs": {
"title": "Pp Defs",
"description": "A dictionary with additional preprocessor definitions. Preprocessor definitions are normally included via INCLUDE_DIRS",
"default": {},
"description": "A dictionary with additional preprocessor definitions. Preprocessor definitions are normally included via INCLUDE_DIRS",
"title": "Pp Defs",
"type": "object"
},
"symbol_skip_mem": {
"title": "Symbol Skip Mem",
"description": "Do not include type members in document symbol results",
"default": false,
"description": "Do not include type members in document symbol results",
"title": "Symbol Skip Mem",
"type": "boolean"
},
"enable_code_actions": {
"title": "Enable Code Actions",
"description": "Enable experimental code actions (default: false)",
"default": false,
"description": "Enable experimental code actions (default: false)",
"title": "Enable Code Actions",
"type": "boolean"
}
}
},
"title": "fortls schema",
"type": "object"
}
7 changes: 4 additions & 3 deletions fortls/schema.py
@@ -1,5 +1,6 @@
from __future__ import annotations

import json
import pathlib

from pydantic import Field, create_model
Expand All @@ -23,13 +24,13 @@ def create_schema(root: pathlib.Path | None = None):
continue
val = arg.default
desc: str = arg.help.replace("%(default)s", str(val)) # type: ignore
only_vals[arg.dest] = Field(val, description=desc) # type: ignore
only_vals[arg.dest] = (type(val), Field(val, description=desc)) # type: ignore

m = create_model("fortls schema", **only_vals)
m.__doc__ = "Schema for the fortls Fortran Language Server"

with open(str(root / "fortls.schema.json"), "w") as f:
print(m.schema_json(indent=2), file=f)
with open(str(root / "fortls.schema.json"), "w", encoding="utf-8") as f:
print(json.dumps(m.model_json_schema(), indent=2), file=f)
print(f"Created schema file: {root / 'fortls.schema.json'}")


Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -62,7 +62,7 @@ dev =
black
isort
pre-commit
pydantic==1.10.13
pydantic
docs =
sphinx >= 4.0.0
sphinx-argparse
Expand Down

0 comments on commit 522307d

Please sign in to comment.