Jump to content

Recommended Posts

Posted

This isn't strictly autoit related, but this seems to be the most active place with a knowledge base in SciTE configuration. I was using SciTE to edit .json files, and I made an EXE I have it run to validate the .json is valid. It works, it creates the red links in console, and if I click a red link it brings me to the line and places an inline error marker

However, if I fix the error and run the validation again, it says everything is fine but the marker for the error is still there. Going to search -> clear bookmarks does clear them

How do I configure my json.properties to clear the line error bookmarks every time I run the go command?

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Posted

No, it's actually python. I have attached it for those who are curious

import sys
import json
import os

def main():
    if len(sys.argv) < 2:
        print("No file specified.")
        sys.exit(1)

    json_file = sys.argv[1]

    if not os.path.isfile(json_file):
        print(f"File not found: {json_file}")
        sys.exit(1)

    try:
        with open(json_file, 'r', encoding='utf-8') as f:
            json.load(f)
        print(f"Valid JSON: {json_file}")
    except json.JSONDecodeError as e:
        # Format error output the way SciTE likes:
        print(f'File "{json_file}", line {e.lineno}, column {e.colno}')
        print(f"Error: {e.msg}")
        sys.exit(1)

if __name__ == "__main__":
    main()

I made a script that has errors in python, looked at it's output, and made my error output be formatted as simularly as I can. it doesn't _initially_ create any inline error markers - they only appear if you doubble click the red lin in the console, which goes to the relevant line of the .json _and_ makes the error marker.

Come to think of it, this might be something au3wrapper does? How exactly does that work?

The json.properties are as follows:

# Define SciTE settings for JSON files.

file.patterns.json=*.json;*.eslintrc;*.jshintrc;*.jsonld
*source.patterns.json=$(file.patterns.json);

filter.json=JSON (json eshintrc jshintrc)|$(file.patterns.json)|
*filter.json=$(filter.json)

lexer.$(file.patterns.json)=json

*language.json=JSON|json||

lexer.json.allow.comments=1
lexer.json.escape.sequence=1

clear.before.execute=1

# JSON keywords
keywords.$(file.patterns.json)=false true null

# JSON-LD keywords
keywords2.$(file.patterns.json)=@id @context @type @value @language @container \
@list @set @reverse @index @base @vocab @graph

# Default
style.json.0=fore:FFFFFF
# Number
style.json.1=fore:#007F7F
# String
style.json.2=fore:#7F0000
# Unclosed string
style.json.3=fore:#FFFFFF,back:#FF0000,eolfilled
# Property name
style.json.4=fore:#880AE8
# Escape sequence
style.json.5=fore:#0B982E
# Line comment
style.json.6=fore:#05BBAE,italics
# Block comment
style.json.7=$(style.json.6)
# Operator
style.json.8=fore:#18644A
# URL/IRI
style.json.9=fore:#0000FF
# JSON-LD compact IRI
style.json.10=fore:#D137C1
# JSON keyword
style.json.11=fore:#0BCEA7,bold
# JSON-LD keyword
style.json.12=fore:#EC2806
# Parsing error
style.json.13=fore:#FFFFFF,back:#FF0000


command.go.*.json="$(SciteDefaultHome)\validate_json.exe" "$(FilePath)"
command.go.subsystem.*.json=1
command.go.clearoutput.*.json=1

This was installed over the scite 4 au3 installation that autoit uses. I still use autoit now and then, but SciTE has become my general purpose text editor for quite some time now.
 

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Posted
14 minutes ago, corgano said:

Come to think of it, this might be something au3wrapper does? How exactly does that work?

Yes. It makes a window ( hidden ) and it communicates sends, and receives via that hidden window. The code is in that file, in AutoIt3 code of course. But if you can read it maybe you can recreate it in python. That's all the help that I can give.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

  • Developers
Posted (edited)
Quote
clear.before.execute If set to 1 then the output pane is cleared before any tool commands are run.

It should always clear the output pane with this setting will.

You can also use the director interface to clear any inline bookmarks/errors when this is what you are looking for.
This is what I do in AutoIt3Wrapper to clear the inline messages:

If $RunBySciTE Then _SendSciTE_Command($My_Hwnd, $SciTE_hwnd, "extender:dostring scite.SendEditor(SCI_ANNOTATIONCLEARALL)")

 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...