genericptr / pascal-language-server

LSP server implementation for Pascal
GNU General Public License v3.0
53 stars 15 forks source link

initializationOptions.options doesn't work #3

Closed genericptr closed 1 year ago

genericptr commented 2 years ago

The options such as includeWorkspaceFoldersAsUnitPaths should be in the options dictionary as the docs state.

"initializationOptions":
                {
                    "options": {
                    },
                    "includeWorkspaceFoldersAsUnitPaths": false,
                    "includeWorkspaceFoldersAsIncludePaths": false,
                    "fpcOptions": [
                        "-Fu/Users/ryanjoseph/Developer/lazarus/components/codetools",
                        "-Fu/Users/ryanjoseph/Developer/fpc/packages/fcl-web/src/jsonrpc",
                        "-Fu/Users/ryanjoseph/Developer/fpc/packages/fcl-json",
                        "-Fu/Users/ryanjoseph/Developer/lazarus/components/lazcontrols",
                        "-Fu/Users/ryanjoseph/Developer/lazarus/components/lazutils",
                    ],
                    "program": "pasls.lpr",
                    "symbolDatabase": "symbols.db",
                },
genericptr commented 2 years ago

Initialization options are taken from TServerSettings and as you can see there is no "options" dict so the idea is totally broken. Maybe just kill it for now and add it back later when it's actually implemented.

TServerSettings = class(TPersistent)
  private
    fBooleans: array[0..32] of Boolean;
    fProgram: String;
    fSymbolDatabase: String;
    fFPCOptions: TStrings;
    fCodeToolsConfig: String;
    fMaximumCompletions: Integer;
    fOverloadPolicy: TOverloadPolicy;
    fConfig: String;
  published
    // Path to the main program file for resolving references
    // if not available the path of the current document will be used
    property &program: String read fProgram write fProgram;
    // Path to SQLite3 database for symbols
    property symbolDatabase: String read fSymbolDatabase write fSymbolDatabase;
    // FPC compiler options (passed to Code Tools)
    property fpcOptions: TStrings read fFPCOptions write fFPCOptions;
    // Optional codetools.config file to load settings from
    property codeToolsConfig: String read fCodeToolsConfig write fCodeToolsConfig;
    // Maximum number of completion items to be returned
    // if the threshold is reached then CompletionList.isIncomplete = true
    property maximumCompletions: Integer read fMaximumCompletions write fMaximumCompletions;
    // Policy which determines how overloaded document symbols are displayed
    property overloadPolicy: TOverloadPolicy read fOverloadPolicy write fOverloadPolicy;
    // procedure completions with parameters are inserted as snippets
    property insertCompletionsAsSnippets: Boolean read fBooleans[0] write fBooleans[0];
    // procedure completions with parameters (non-snippet) insert
    // empty brackets (and insert as snippet)
    property insertCompletionProcedureBrackets: Boolean read fBooleans[1] write fBooleans[1];
    // workspaces folders will be added to unit paths (i.e. -Fu)
    property includeWorkspaceFoldersAsUnitPaths: Boolean read fBooleans[2] write fBooleans[2];
    // workspaces folders will be added to include paths (i.e. -Fi)
    property includeWorkspaceFoldersAsIncludePaths: Boolean read fBooleans[3] write fBooleans[3];
    // syntax will be checked when file opens or saves
    property checkSyntax: Boolean read fBooleans[4] write fBooleans[4];
    // syntax errors will be published as diagnostics
    property publishDiagnostics: Boolean read fBooleans[5] write fBooleans[5];
    // enable workspace symbols
    property workspaceSymbols: Boolean read fBooleans[6] write fBooleans[6];
    // enable document symbols
    property documentSymbols: Boolean read fBooleans[7] write fBooleans[7];
    // completions contain a minimal amount of extra information
    property minimalisticCompletions: Boolean read fBooleans[8] write fBooleans[8];
    // syntax errors as shown in the UI with ‘window/showMessage’
    property showSyntaxErrors: Boolean read fBooleans[9] write fBooleans[9];
    // ignores completion items like "begin" and "var" which may interfer with IDE snippets
    property ignoreTextCompletions: Boolean read fBooleans[10] write fBooleans[10];
    // config file or directory to read settings from (will support multiple formats)
    property config: String read fConfig write fConfig;

    function CanProvideWorkspaceSymbols: boolean;
  public
    procedure AfterConstruction; override;
    procedure ReplaceMacros(Macros: TMacroMap);
  end;
genericptr commented 1 year ago

yeah. there is no "options" anymore so it's been removed from the readme.