Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

[Bug] Custom scripting directories don't work properly #70

Closed
maxijabase opened this issue Feb 6, 2021 · 1 comment
Closed

[Bug] Custom scripting directories don't work properly #70

maxijabase opened this issue Feb 6, 2021 · 1 comment
Labels
bug Something isn't working fixed Bug fixed, waiting to be released

Comments

@maxijabase
Copy link
Member

maxijabase commented Feb 6, 2021

Apparently, for the IDE to compile plugins that have stuff that are in custom defined scripting directories, they must be pointing directly to the folder that has all (or the) .inc files, BUT this renders Go To Definition (CTRL+CLICK) unusable.

.\sourcepawn\configs\sm_1_10_0_6478;C:\spcodecomp\customconfigs\include

Furthermore, if you don't specify an include folder, and just point to the folder that HAS the include (just like the stock folder), Go To Definition WILL work, but plugin will not compile at all - it will spit that the custom include used there is missing (cannot read from file "include")

.\sourcepawn\configs\sm_1_10_0_6478;C:\spcodecomp\customconfigs

One COULD delete the part in the PathBuilder where the word "include" is added:

// First search across all scripting directories

            var sm = MatchDefinition(Program.Configs[Program.SelectedConfig].GetSMDef(), word, e);
            if (sm != null)
            {
                var config = Program.Configs[Program.SelectedConfig].SMDirectories;

                foreach (var cfg in config)
                {
                    var file = Path.GetFullPath(Path.Combine(cfg, /*"include",*/ sm.File)) + ".inc"; // <------- here
                    await Task.Delay(100);
                    var result = Program.MainWindow.TryLoadSourceFile(file, true, false, true);
                    if (!result)
                    {
                        Debug.Print($"File {file} not found!");
                        continue;
                    }
                    var newEditor = Program.MainWindow.GetCurrentEditorElement();
                    Debug.Assert(newEditor != null);
                    newEditor.editor.TextArea.Caret.Offset = sm.Index;
                    newEditor.editor.TextArea.Caret.BringCaretToView();
                    newEditor.editor.TextArea.Selection = Selection.Create(newEditor.editor.TextArea, sm.Index, sm.Index + sm.Length);
                    return;
                }
            }

BUT, although this enables custom directories to both be valid for compiling and apprearing in autocompletion, breaks the stock SM includes folder. This is because now, you must specify \include in all SM directores you set in the config - if you do that in the stock config, the program loses track of spcompiler.exe, effectively breaking compilation.

.\sourcepawn\configs\sm_1_10_0_6478\include;C:\spcodecomp\customconfigs\include

One of the possible outcomes would be rethinking of where the program stores and utilizes the SP compiler, but I hope to be wrong, luckily someone else than me might give it a look and come up with a less invasive solution, who knows.

@maxijabase maxijabase added the bug Something isn't working label Feb 6, 2021
@maxijabase
Copy link
Member Author

@maxijabase maxijabase mentioned this issue Feb 11, 2021
2 tasks
@maxijabase maxijabase added the fixed Bug fixed, waiting to be released label Feb 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working fixed Bug fixed, waiting to be released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant