-1

I'm currently working on customizing the syntax highlighting theme in TextMate for PHP code. I want to achieve two things:

  1. Selecting Multiple Scopes: How can I select and modify multiple scopes simultaneously in TextMate's syntax highlighting configuration?

  2. Scope Separation for example "keyword.other.type.php": Specifically, I want to target the scope "keyword.other.type.php" which is used both for return types and type casting. However, I'd like to style these two instances differently. How can I separate the styling of this scope based on whether it's used as a return type or for type casting?

This is for second question examples based on the return type (): string and type casting (string):

function rofl(): string {}
function rofl(string $variable) {}

This my current settings.json in case you want to see it:

{
    "editor.semanticHighlighting.enabled": false,
    //Editor font size
    "editor.fontSize": 20,
    //Editor comment suggestions
    "editor.quickSuggestions": {
        "comments": "on"
    },
    //Auto Cloe Tag
    "auto-close-tag.disableOnLanguage": [],
    "auto-close-tag.activationOnLanguage": [
        "*"
    ],
    "auto-close-tag.SublimeText3Mode": true,
    //Auto Rename Tag
    "auto-rename-tag.activationOnLanguage": [
        "*"
    ],
    //Live server
    "liveServer.settings.donotShowInfoMsg": false,
    "liveServer.settings.CustomBrowser": "chrome",
    "liveServer.settings.fullReload": true,
    //Path Intellisense
    "path-intellisense.autoSlashAfterDirectory": true,
    "path-intellisense.extensionOnImport": true,
    //Php debug
    "php.debug.executablePath": "E://xampp//php//ext//php_xdebug.dll",
    //Explorer icons
    "workbench.iconTheme": "vscode-icons",
    "[php]": {
        "editor.defaultFormatter": "DEVSENSE.phptools-vscode",
        "editor.formatOnSave": true
    },
    "explorer.confirmDelete": false,
    "[json]": {
        "editor.defaultFormatter": "vscode.json-language-features",
        "editor.formatOnSave": true
    },
    "[jsonc]": {
        "editor.defaultFormatter": "vscode.json-language-features",
        "editor.formatOnSave": true
    },
    "editor.inlineSuggest.enabled": false,
    "php.executables": {},
    "php.version": "8.2",
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "DEVSENSE.phptools-vscode",
    "editor.wordWrap": "wordWrapColumn",
    "editor.wordWrapColumn": 80,
    "editor.snippetSuggestions": "bottom",
    "php.format.rules.arrayInitializersNewLineAfterLastElement": true,
    "php.format.rules.arrayInitializersNewLineBeforeFirstElement": true,
    "php.format.rules.arrayInitializersWrap": "on_every_item",
    "php.format.rules.callParametersNewLineAfterLeftParen": true,
    "php.format.rules.callParametersNewLineBeforeRightParen": true,
    "php.format.rules.callParametersWrap": "on_every_item",
    "php.format.rules.declKeepRightParenAndOpenBraceOnOneLine": true,
    "php.format.rules.declParametersNewLineAfterLeftParen": true,
    "php.format.rules.declParametersNewLineBeforeRightParen": true,
    "php.format.rules.declParametersWrap": "on_every_item",
    "php.format.rules.forStatementNewLineAfterLeftParen": true,
    "php.format.rules.forStatementNewLineBeforeRightParen": true,
    "php.format.rules.forStatementWrap": "on_every_item",
    "php.format.rules.groupUseNewLineBeforeFirstDeclaration": true,
    "php.format.rules.groupUseWrap": "on_every_item",
    "php.format.rules.ifStatementNewLineAfterLeftParen": true,
    "php.format.rules.ifStatementNewLineBeforeRightParen": true,
    "php.format.rules.implementsListWrap": "on_every_item",
    "php.format.rules.newLineAfterImplements": true,
    "php.format.rules.openBraceOnNewLineForAnonymousClasses": true,
    "php.format.rules.openBraceOnNewLineForFunctions": true,
    "php.format.rules.openBraceOnNewLineForTypes": true,
    "php.format.rules.spaceAfterCast": true,
    "php.format.rules.spaceAroundConcatenation": true,
    "php.format.rules.spaceBeforeParenthesesInControlStatements": true,
    "php.format.rules.spaceWithinCatchParens": false,
    "php.format.rules.switchStatementNewLineAfterLeftParen": true,
    "php.format.rules.switchStatementNewLineBeforeRightParen": true,
    "php.format.rules.whileStatementNewLineAfterLeftParen": true,
    "html.format.templating": true,
    "html.format.wrapLineLength": 80,
    "html.format.wrapAttributes": "preserve-aligned",
    "php.inlayHints.types.return": true,
    "JSON-zain.json.autorefresh": true,
    "[javascript]": {
        "editor.defaultFormatter": "vscode.typescript-language-features",
        "editor.formatOnType": false
    },
    "editor.unicodeHighlight.invisibleCharacters": false,
    "editor.unicodeHighlight.ambiguousCharacters": false,
    "[html]": {
        "editor.defaultFormatter": "vscode.html-language-features"
    },
    "[css]": {
        "editor.defaultFormatter": "vscode.css-language-features",
        "editor.formatOnSave": true
    },
    "[xml]": {
        "editor.defaultFormatter": "jock.svg"
    },
    "editor.bracketPairColorization.enabled": false,
    "editor.guides.bracketPairs": true,
    "php.hover.fullname": true,
    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": "keyword.other.type.php meta.function.php",
                "settings": {
                    "foreground": "#f22c3d"
                }
            },
            {
                "scope": "keyword.other.type.php meta.function.parameter.typehinted.php",
                "settings": {
                    "foreground": "#2c96d2"
                }
            }
        ]
    },
}

So far I have tried to write scopes like this but it had no effect:

    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": "keyword.other.type.php meta.function.php",
                "settings": {
                    "foreground": "#f22c3d"
                }
            },
            {
                "scope": "keyword.other.type.php meta.function.parameter.typehinted.php",
                "settings": {
                    "foreground": "#2c96d2"
                }
            }
        ]
    }

I tried to disable all extensions. I made it so that sematic highlighting is disabled in the settings.json with: "editor.semanticHighlighting.enabled": false

I checked developers tools and I don't see any overrides in the css styling.

Feel free to share ideas, because I am out of them. Thank you for your time.

Neo
  • 1
  • 1

0 Answers0