AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Code Snippets/Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=83)
-   -   [TUT] Compiling AMXX plugins with Sublime Text (https://forums.alliedmods.net/showthread.php?t=293376)

Celena Luna 06-17-2020 13:57

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
PHP Code:

Exception in thread Thread-2:
Traceback (most recent call last):
  
File "./python3.3/threading.py"line 901in _bootstrap_inner
  File 
"C:\Users\SKon1\AppData\Roaming\Sublime Text 3\Packages\AmxxEditor\AmxxEditor.py"line 1016in run
    self
.process(file_nameview_buffer)
  
File "C:\Users\SKon1\AppData\Roaming\Sublime Text 3\Packages\AmxxEditor\AmxxEditor.py"line 1027in process
    self
.load_from_file(view_file_name, include, current_nodecurrent_nodebase_includes)
  
File "C:\Users\SKon1\AppData\Roaming\Sublime Text 3\Packages\AmxxEditor\AmxxEditor.py"line 1057in load_from_file
    
(file_nameexists) = get_file_name(view_file_namebase_file_name)
  
File "C:\Users\SKon1\AppData\Roaming\Sublime Text 3\Packages\AmxxEditor\AmxxEditor.py"line 1100in get_file_name
    
return (file_namepath_exists)
UnboundLocalErrorlocal variable 'file_name' referenced before assignment 

And about Profile
PHP Code:

This list shows how much time each plugin has taken to respond to each event:

on_activated:
    Default.
pane0.001s totalmean0.000smax0.001s

on_close
:
    Default.
pane0.000s total

on_deactivated
:
    Default.
history_list0.001s totalmean0.000smax0.001s

on_hover
:
    Default.
symbol0.040s totalmean0.001smax0.021s
    AmxxEditor
.AmxxEditor0.107s totalmean0.003smax0.082s

on_load
:
    Default.
detect_indentation0.036s totalmean0.018smax0.032s
    
Default.exec0.005s totalmean0.002smax0.005s

on_pre_close
:
    Default.
history_list0.001s total

on_selection_modified
:
    
AmxxEditor.AmxxEditor0.225s totalmean0.001smax0.037s 

it look normal but I got lag everytime I open a new plugin

addons_zz 06-17-2020 14:29

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
I just launched an update fixing the `UnboundLocalError: local variable 'file_name' referenced before assignment`.

How much big is this lag when you create a new plugin? 10 seconds?

The profile results look normal. Did you run the `Profile` thing after opening a plugin? Can you try running the Profile thing again after opening several plugins? Can you PM the full Sublime Text console log after trying it?

Celena Luna 06-17-2020 14:54

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
Spoiler


The lag is 10s everytime it generate syntax summary

addons_zz 06-17-2020 15:27

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
That `generating syntax summary` is from Sublime Text. You can try disabling it by going to the menu `Preferences -> Settings` and setting `"index_files": false`

Alternatively, you can try to limit the number for CPU's Sublime Text will use to index files by setting `"index_workers": 1` instead of completely disabling the file indexing:
Code:
    // File indexing parses all files in the side bar, and builds an index of     // their symbols. This is required for Goto Definition to work.     "index_files": true,     // Set the number threads to use for indexing. A value of 0 will make     // Sublime Text guess based on the number of cores. Use the index_files     // setting to disable all workers.     "index_workers": 0,

JocAnis 07-12-2020 08:18

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
hello. i also see some lag while opening Sublime Text Editor (but only from lately)
with doing index_files false, and index_workers: 1, i got same results...could be there any other solutions?

addons_zz 07-12-2020 12:56

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
Try looking into:
  1. Setting `index_workers: 0`

  2. https://forum.sublimetext.com/t/how-to-determine-if-sublime-is-slow-vs-plugins/25618

    After completing opening Sublime Text and the lag has stopped, look into `Tools > Developer > Profile Plugins` and post here/pm the results.

  3. After completing opening Sublime Text and the lag has stopped, to go the menu `View -> Show Console` and post here/pm the results.

  4. https://forum.sublimetext.com/t/sublime-text-is-really-laggy-all-of-a-sudden/36655/

    Try setting `show_definitions: false`

How do you describe this lag? How much time does it last?

JocAnis 07-13-2020 08:25

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
Lag appears when i open sublime text editor (i have ~10 tabs/sma already opened there), it lasts 3-5sec. then if i open new .sma (i think only for smas bigger than like 500 lines) it again got stuck for 3-5 sec

edit: that lag on startup always happens after ~5sec after opening, meaning not instant lag while opening app
show consone:
Code:

DPI mode: per-monitor v2
startup, version: 3211 windows x64 channel: stable
executable: /D/Program Files/Sublime Text 3/sublime_text.exe
working dir: /D/Program Files/Sublime Text 3
packages path: /D/Program Files/Sublime Text 3/Data/Packages
state path: /D/Program Files/Sublime Text 3/Data/Local
zip path: /D/Program Files/Sublime Text 3/Packages
zip path: /D/Program Files/Sublime Text 3/Data/Installed Packages
ignored_packages: ["Vintage"]
Unable to parse color value adb7c9 at Packages/Theme - One Dark/One Dark.tmTheme:unknown
pre session restore time: 0.260836
loading dictionary Packages/Language - English/en_US.dic
startup time: 0.356836
first paint time: 0.358836
reloading plugin Default.arithmetic
reloading plugin Default.auto_indent_tag
reloading plugin Default.block
reloading plugin Default.colors
reloading plugin Default.comment
reloading plugin Default.convert_color_scheme
reloading plugin Default.convert_syntax
reloading plugin Default.copy_path
reloading plugin Default.detect_indentation
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.indentation
reloading plugin Default.install_package_control
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.profile
reloading plugin Default.quick_panel
reloading plugin Default.rename
reloading plugin Default.run_syntax_tests
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.settings
reloading plugin Default.show_scope_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.ui
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin ShellScript.ShellScript
reloading plugin 0_packagesmanager_loader.00-package_control
reloading plugin 0_packagesmanager_loader.10-debugtools
reloading plugin 0_packagesmanager_loader.30-channelmanager
reloading plugin AltUp.run_multiple_commands
reloading plugin AmxxChannel.commands
reloading plugin AmxxChannel.settings
reloading plugin ClearCursorsCarets.clear_cursors_carets
reloading plugin DefaultSyntax.default_syntax
reloading plugin FixedToggleFindPanel.fix_linux_selection_reset
reloading plugin FixedToggleFindPanel.fixed_focus_on_side_bar
reloading plugin FixedToggleFindPanel.fixed_paste_and_indent
reloading plugin FixedToggleFindPanel.fixed_toggle_find_panel
reloading plugin FixProjectSwitchRestartBug.fix_project_switch_restart_bug
FixProjectSwitchRestartBug Error: Could not import the MaxPane package! No module named 'MaxPane'
reloading plugin ForceRewriteSublimeSettings.force_rewrite_sublime_settings
reloading plugin MoveText.move_text
reloading plugin OverrideCommitCompletion.overwrite_commit_completion
reloading plugin OverrideUnpackedPackages.override_unpacked_packages
reloading plugin PowerCursors.power_cursors
reloading plugin RememberCommandPaletteInput.input_history
reloading plugin RememberCommandPaletteInput.view_commands
reloading plugin SideBySideSettings.sxs_settings
reloading plugin zz_packagesmanager_reenabler
reloading plugin Default.install_package_control_extended
reloading plugin Default.monkey_patch_sublime_modules
reloading plugin Default.scroll_lines
reloading plugin Default.synced_side_bar_watcher
reloading plugin Default.zz_reload_default_package
reloading plugin AmxxEditor.AmxxEditor
reloading plugin AmxxEditor.install_main_menu
reloading plugin BetterFindBuffer.find_results
reloading plugin debugtools.setup
reloading plugin PackagesManager.1_reloader
reloading plugin PackagesManager.2_bootstrap
reloading plugin PackagesManager.PackagesManager
reloading plugin ZzzReloadDefaultPackage.zz_reload_default_package
reloading plugin Default.arithmetic
reloading plugin Default.auto_indent_tag
reloading plugin Default.block
reloading plugin Default.colors
reloading plugin Default.comment
reloading plugin Default.convert_color_scheme
reloading plugin Default.convert_syntax
reloading plugin Default.copy_path
reloading plugin Default.detect_indentation
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.indentation
reloading plugin Default.install_package_control
reloading plugin Default.install_package_control_extended
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.monkey_patch_sublime_modules
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.profile
reloading plugin Default.quick_panel
reloading plugin Default.rename
reloading plugin Default.run_syntax_tests
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.scroll_lines
reloading plugin Default.settings
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.show_scope_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.synced_side_bar_watcher
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.ui
plugins loaded
[zz_reload_default_package.py] No changes in any settings file!
PackagesManager: No updated packages
generating syntax summary

profile plugins:
Code:

This list shows how much time each plugin has taken to respond to each event:

on_activated:
    Default.pane: 0.005s total, mean: 0.001s, max: 0.005s
    Default.history_list: 0.032s total, mean: 0.005s, max: 0.030s
    FixedToggleFindPanel.fixed_toggle_find_panel: 0.034s total, mean: 0.006s, max: 0.031s
    RememberCommandPaletteInput.input_history: 0.000s total, mean: 0.000s, max: 0.000s

on_deactivated:
    Default.history_list: 0.002s total, mean: 0.000s, max: 0.002s

on_load:
    FixProjectSwitchRestartBug.fix_project_switch_restart_bug: 0.000s total
    Default.detect_indentation: 0.031s total
    Default.exec: 0.042s total

on_selection_modified:
    Default.history_list: 0.001s total, mean: 0.000s, max: 0.001s


addons_zz 07-13-2020 13:08

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
You can try installing Sublime Text build 3207 (https://download.sublimetext.com/Sub...64%20Setup.exe)

To migrate, just copy your `Data` directory over the 3207 `Data` directory.

You can also try setting the AmxxEditor setting `live_refresh_delay` to 0

OciXCrom 01-31-2021 08:10

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
Please, if you made any changes these days, revert them. Having "live_refresh_delay" set to anything above 0 makes Sublime unusable because of constant lag spikes.
Console outputs "generating syntax summary" each time a lag spike occurs.

addons_zz 01-31-2021 11:02

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
The last change I did was in Jun 17, 2020.

This generating syntax summary is a Sublime Text feature. Can you try setting on your Preferences -> Settings
  1. "index_workers": 1, // and see if it improved the problem
  2. "index_workers": 0, // if it do not help, them this
  3. "index_files": false, // if it do not help, them this
  4. "show_git_status": false, // if it do not help, them this
  5. "show_definitions": false,

See the messages after this post https://forums.alliedmods.net/showth...11#post2706211

Are you using a portable version of Sublime Text? You can try renaming your Data directory and doing a clean install and see if that fixes the problem.

OciXCrom 02-03-2021 14:58

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
None of the settings helped. Refreshing the Data directory did the trick. Thanks.

Celena Luna 02-07-2021 21:18

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
Just some niche picking:

PHP Code:

#include < engine > 

when the include line write like this, sublime can't read it but the compiler can.

addons_zz 02-09-2021 18:21

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
Quote:

Originally Posted by Celena Luna (Post 2736093)
when the include line write like this, sublime can't read it but the compiler can.

What does mean "sublime can't read"?

Do you see any `Include File Not Found: ` on your Sublime Text console?

Celena Luna 02-10-2021 10:52

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
Quote:

Originally Posted by addons_zz (Post 2736327)
What does mean "sublime can't read"?

Do you see any `Include File Not Found: ` on your Sublime Text console?

it is
Code:

Include File Not Found
still can compile but when writing it won't show tooltips
The problem was there is space in front of the include

Normal
Code:

#include <engine>
Error
Code:

#include < engine >
it is a small thing but it might trouble someone

OciXCrom 02-18-2021 16:07

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
Quote:

Originally Posted by OciXCrom (Post 2735611)
None of the settings helped. Refreshing the Data directory did the trick. Thanks.

Lag spikes started yet again.

OciXCrom 02-19-2021 07:40

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
It keeps generating syntax summary even though "live_refresh_delay" is set to 0.0.

Napoleon_be 03-23-2021 16:04

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
Could someone perhaps help me? I've recently installed my new pc with Sublime on it and AmxxEditor. I'm only having trouble compiling plugins... This is the output when i try to compile a standard test plugin.

Code:


Compiling test... Current time is: 21:01:53,94 - di

AMX Mod X Compiler 1.10.0.5416
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2013 AMX Mod X Team

Header size:            192 bytes
Code size:              92 bytes
Data size:              376 bytes
Stack/heap size:      16384 bytes
Total requirements:  17044 bytes
Done.
There was an compilation error. Exiting...

Took 0:00:00,07 seconds to run this script.

[Finished in 0.1s]

PHP Code:

/* Sublime AMXX Editor v2.2 */

#include <amxmodx>
// #include <amxmisc>
// #include <cstrike>
// #include <engine>
// #include <fakemeta>
// #include <hamsandwich>
// #include <fun>
// #include <xs>
// #include <sqlx>

#define PLUGIN  "New Plug-In"
#define VERSION "1.0"
#define AUTHOR  "Author"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
// Add your code here...


However, when i use my test.sma file on amxxpc.exe, it compiles without any problems.

EDIT: found the problem, there was a duplicate map somewhere in my files that didn't belong there.

iceeedr 05-26-2021 11:25

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
A new version of Sublime was released breaking the operation with amx.

Code:

__init__() got an unexpected keyword argument 'kill_previous'
[cmd: ['D:\\Sublime\\Data\\Packages/User/AmxxEditor/AmxxEditor.bat', 'C:\\Users\\XXX\\Desktop\\Test.sma', 'Test', 'D:\\Sublime\\Data\\Packages', 'C:\\Users\\XXX\\Desktop']]
[dir: C:\Users\XXX\Desktop]
[path: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\XXX\AppData\Local\Microsoft\WindowsApps;C:\adb;C:\Program Files\dotnet\;C:\Users\XXX\AppData\Local\Microsoft\WindowsApps;]
[Finished]


addons_zz 05-26-2021 18:51

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
Quote:

Originally Posted by iceeedr (Post 2747884)
A new version of Sublime was released breaking the operation with amx.

Are you using Sublime Text 4 ?

For Sublime Text 4, I think I would need to patch few things. But for now, I still using Sublime Text 3.

iceeedr 05-26-2021 19:46

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
Quote:

Originally Posted by addons_zz (Post 2747912)
Are you using Sublime Text 4 ?

For Sublime Text 4, I think I would need to patch few things. But for now, I still using Sublime Text 3.

Yes, build 4107 has any chance that you can "fix" this version or do you advise me to go back to the previous one?

iceeedr 11-09-2021 08:27

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
Quote:

Originally Posted by addons_zz (Post 2747912)
Are you using Sublime Text 4 ?

For Sublime Text 4, I think I would need to patch few things. But for now, I still using Sublime Text 3.

Any news?

Celena Luna 03-16-2022 23:07

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
I reinstalled sublime 3 and installed AmxxEditor from Package Control
But for some reason, when I checked the Config and Setting, all 4 of them are blank

Console Log: https://pastebin.com/AbCUWBM8

addons_zz 03-17-2022 21:34

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
Quote:

Originally Posted by Celena Luna (Post 2774395)
But for some reason, when I checked the Config and Setting, all 4 of them are blank

Can you edit this file and remove the `, errors="ignore"` from `text_file = open( target_file, "wb", errors="ignore" )`, i.e., let it like this:
HTML Code:

File: .../Packages/AmxxEditor/AmxxEditor.py
197:        text_file = open( target_file, "wb" )

Then, restart Sublime Text?

This should be fixed when I release the next version.

Celena Luna 03-17-2022 22:27

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
Quote:

Originally Posted by addons_zz (Post 2774544)
Can you edit this file and remove the `, errors="ignore"` from `text_file = open( target_file, "wb", errors="ignore" )`, i.e., let it like this:
HTML Code:

File: .../Packages/AmxxEditor/AmxxEditor.py
197:        text_file = open( target_file, "wb" )

Then, restart Sublime Text?

This should be fixed when I release the next version.

Thank you, it is fixed :)

iceeedr 08-30-2022 17:39

Re: [TUT] Compiling AMXX plugins with Sublime Text
 
Quote:

Originally Posted by addons_zz (Post 2774544)
Can you edit this file and remove the `, errors="ignore"` from `text_file = open( target_file, "wb", errors="ignore" )`, i.e., let it like this:
HTML Code:

File: .../Packages/AmxxEditor/AmxxEditor.py
197:        text_file = open( target_file, "wb" )

Then, restart Sublime Text?

This should be fixed when I release the next version.

Any news, or possibility of upgrading to sublime 4?


All times are GMT -4. The time now is 05:18.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.