View Single Post
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 08-26-2017 , 08:56   Re: [Editor?] AMXXPawn Language Service for Visual Studio Code
Reply With Quote #12

Quote:
Originally Posted by Hedgehog95 View Post
KliPPy,
I mean support of relative paths or special variable for project directory.
Can you define "project directory" precisely? In VSCode there are no projects, but workspaces, which are folders that have been opened in VSCode.
So in VSCode there are two contexts: workspace (which only exists if a folder is opened) and currently opened file.

There are THESE substitution variables available, but they are only available within tasks.json, so that doesn't help us here as they are not resolved/expanded within settings.
There is some talk HERE to support it in settings.json (which can be overriden per-workspace) but it hasn't been implemented yet, nor do extensions have a service to resolve those substitution variables.

I can write a substitution variables resolver I guess, but keep reading this post, what I am about to write may help you.

Quote:
Originally Posted by JusTGo View Post
can you add somthing like this :

PHP Code:
  // Where should compiler. Can be:
  //   - 'source' (same as input)
  //   - 'path' (specified in amxxpawn.compiler.executablePath setting)
  
"amxxpawn.compiler.executableType""source"
if source is set in this case it will look amxxpc.exe in the input folder.

PHP Code:
  // Where should include files. Can be:
  //   - 'source' ( include directory,  relative to input directory )
  //   - 'path' (specified in amxxpawn.compiler.includePaths setting)
  
"amxxpawn.compiler.includeType ""source"
will look for include folder.
I don't think I want to support that, as there is probably no need. If you really have a folder with many files that may use a different compiler, then read THIS. You can create a .vscode/settings.json in your directory and then set your compiler path there.

Also, here is another (and probably better) solution - why not create a BUILD TASK in .vscode/tasks.json for your workspace?
Here's a working example:
Code:
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "taskName": "Compile Plugin",
            "type": "process",
            "command": "${workspaceRoot}\\amxxpc.exe",
            "args": [
                "${file}",
                "-i${workspaceRoot}\\include",
                "-o${workspaceRoot}\\output\\${fileBasenameNoExtension}.amxx"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}
Now when you open any file in that workspace you can just do Ctrl+Shift+B and it will compile your plugin and put it in the output/ directory.

Last edited by klippy; 08-26-2017 at 09:02.
klippy is offline